views:

90

answers:

4

I haven't seen this datetime format before:

2010-08-19T16:09:07.08

The nearest I have found in the msdn is represented by the "o" standard format string, but it's not quite the same.

So what is this format? If it's standard can I reproduce it with a standard format string?

Thanks,

Phil

+10  A: 

This is the ISO 8601 international standard format. I believe that it is not designed for human readability but intended for machine interoperability.

In .NET, you can format DateTime objects in this format like this:

myDateTime.ToString("s")

For more date formatting strings, see Standard DateTime Format Strings on MSDN.

Timwi
That was fast! I can't even accept your answer yet.
Phil
+3  A: 

Check this link. It mentions that format under ISO 8601.

http://msdn.microsoft.com/en-us/library/ms187819.aspx

Mamta Dalal
+2  A: 

It is the standard universal dateformat.

http://wwp.greenwichmeantime.com/info/iso.htm

Simmo
+1  A: 

It's worth noting two things about ISO 8601.

  1. It's not just the international standard, but has been adopted as the national standard and nation-bloc standard (e.g. of EU) of almost everywhere (IIRC only Norway and North Korea hadn't the last time I checked but this was some time ago so both history and the strength of my memory may have moved on).

  2. ISO 8601 defines several different formats. It's really a standard for creating formats ("profiles of ISO 8601") for particular uses. Some limited-purpose profiles aren't even unambiguous identifiers! The above is the non-compact format that uses months and days rather than weeks or day-of-year, does not have time-zone information and is accurate to 10ms. There are other formats that also fit ISO 8601 and meet different requirements. This is important because a lot of people will write "ISO 8601" when they are thinking of the format they most often use, and a lot of people will read "ISO 8601" to mean the format they most often use, but the writer and reader may be thinking of different formats. Interoperability bugs ensue and they blame each other. When you specify 8601, be explicit about the profile(s) used. If you read "ISO 8601" in a spec, make sure you find out which profile(s) they mean. In terms of the web, referenceing the NOTE-Datetime or the formats described by XMLSchema (even if you don't use XML Schemata) can be useful. More about web datetime formats by myself is here

Jon Hanna