Home Notices Documents Classes Download Others Rice
Classes  >  datetime  >  ToString(string)
datetime class : ToString(string) method

Description

Gets a string representation that is formatted with the specified format.

Syntax

datetimeInstance.ToString(string format)

Arguments

ClassNameDescription
stringformatformat

Return value

ClassDescription
stringA formatted string representation.

Sample code

1:

datetime dt = new datetime("2013/12/14 10:10:9");

2:

string formedString = dt.ToString("MMM dd, yyyy"); // 12 14, 2013

Notes

It's a wrapper of the System.DateTime.ToString(String) method.

Links for reference

Copyright © Rice All rights reserved.