Search code examples
c#datetime-formatinvariantculture

DateTime formats used in InvariantCulture


I have to pre-validate in Javascript a string that will be a DateTime in c#. The DateTime parse uses InvariantCulture.

Does anyone know the DateTime formats defined for InvariantCulture?


Solution

  • Compiling information from standard date and time format strings:

    Pattern Example
    Short Date Pattern ("d") MM/dd/yyyy
    Long Date Pattern ("D") dddd, dd MMMM yyyy
    Full Date Short Time ("f") dddd, dd MMMM yyyy HH:mm
    Full Date Long Time ("F") dddd, dd MMMM yyyy HH:mm:ss
    General Date Short Time ("g") MM/dd/yyyy HH:mm
    General Date Long Time ("G") MM/dd/yyyy HH:mm:ss
    Month ("M", "m") MMMM dd
    Round-Trip ("O", "o") yyyy-MM-ddTHH:mm:ss.fffffffK
    RFC1123 ("R", "r") ddd, dd MMM yyyy HH:mm:ss GMT
    Sortable ("s") yyyy-MM-ddTHH:mm:ss
    Short Time ("t") HH:mm
    Long Time ("T") HH:mm:ss
    Universal Sortable ("u") yyyy-MM-dd HH:mm:ssZ
    Universal Full ("U") dddd, dd MMMM yyyy HH:mm:ss
    Year Month ("Y", "y") yyyy MMMM