Hi,
I am using DateTime.Now.ToString("yyyyMMddThhmmss"), but time is
displayed in 12-hours format. How can I force .NET to display 24 hours
format? Can I do something with the CultureInfo of the current thread.
I do not want it to be dependent of the settings of the computer.
Any help appreciated.
Regards,
Henk
Ben Schwehn - 20 Sep 2007 11:32 GMT
On Thu, 20 Sep 2007 03:10:54 -0700, hvj wrote:
> Hi,
>
> I am using DateTime.Now.ToString("yyyyMMddThhmmss"), but time is
> displayed in 12-hours format. How can I force .NET to display 24 hours
> format? Can I do something with the CultureInfo of the current thread. I
> do not want it to be dependent of the settings of the computer.
use HH instead of hh
hvj@paralax.nl - 21 Sep 2007 06:45 GMT
> On Thu, 20 Sep 2007 03:10:54 -0700, hvj wrote:
> > Hi,
[quoted text clipped - 5 lines]
>
> use HH instead of hh
Thanks! I'm using it to name a file, so I can't include ':'.
Ben Schwehn - 20 Sep 2007 11:55 GMT
On Thu, 20 Sep 2007 03:10:54 -0700, hvj wrote:
> I am using DateTime.Now.ToString("yyyyMMddThhmmss"), but time is
Also, if you're trying to format to ISO 8601 (I assume this because of
the 'T' separator), the format you're using is incorrect. Correct format
is for exampple:
1997-07-16T19:20:30
you can also use XmlConvert.ToString(dateTime,
XmlDateTimeSerializationMode.XXX);
to format to ISO 8601
Ben