Date Time Format

  • Thread starter Thread starter karunakar
  • Start date Start date
K

karunakar

Hi All

Here datetime format 10/14/2004 6:29:20 PM Like

this is getting from database.

Date only i need to populate in my applcation.

but i need to populate the

Thank u

Venu
 
You want: .ToShortDateString() See Below:

System.DateTime x = System.DateTime.Now;

MessageBox.Show(x.ToShortDateString());
 
Venu,

The format you would want to use is:

M/d/yyyy h:mm:ss tt



Like this:



// Get the string representation of the current DateTime.

string s = DateTime.Now.ToString("M/d/yyyy h:mm:ss tt");



If you want to show trailing 0's, then you should double the M, d, or h,
for the month, day, or hour respectively.



Hope this helps.
 
Back
Top