Click here to Skip to main content
15,888,733 members

Response to: how to get the full date from DateTime in windows application

Revision 1
Hi,

take a look at DateTime.ToLongDateString() and ToLongTimeStamp()

C#
DateTime d = DateTime.Now;
string s = d.ToLongDateString() + " " + d.ToLongTimeString();

Will become:
Wednesday, October 10, 2012 7:44:40 AM


If you're using these methods, the time format will allways be correct regarding the current culture.
Posted 9-Oct-12 19:45pm by Andy411.
Tags: , , ,