Datetime issue

The nasty datetime format issue seems like is universal. In c# world, depends on the locale, it would format to string and parse to datetime differently and could wrongly as well.

For example, for cultureinfo (“ja-JP”), datetime.tostring() could be yyyy/MM/d format which not recognized by a lot other systems or places.
While for same locale, it would parse 04Apr16 as 2004-04-16.

To solve and avoid the issues, invariantculture should be the cure. Always use invariantculture for parsing and for formating:
Datetime.parseExact(dateString, format, invariantculture).tostring(format, invariantculture).