Conversion of Datetime from 12 hours to 24 hours format

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,

double timestamp = 1113211532;
System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
dateTime = dateTime.AddSeconds(timestamp);
string printDate = dateTime.ToShortDateString() + " " + dateTime.ToShortTimeString();
MessageBox.Show(printDate);

Here the 4/11/2005 9.25 AM is the output which i am getting
bur the time format i require is 24 hours time instead of 12 hours time.
please reply me with a solution


View the full article
 
Back
Top