Date format strings in .Net and Java

Posted by mizipzor on Stack Overflow See other posts from Stack Overflow or by mizipzor
Published on 2010-05-11T16:43:13Z Indexed on 2010/05/11 20:14 UTC
Read the original article Hit count: 316

Filed under:
|
|
|
|

I have an application that runs on both C# .Net and Java. Two entirely separate but identical code bases. The problem Im having is formatting date and numbers.

For example: A user running the .Net variant is inputting a date and a format string. The 26th of April 1986 is formatted 1986-04-26. The actual date, along with the format string, is serialized to an XML file. Later another user running the Java variant opens said XML file and looks at the date. I want them to look the same.

Whats the best approach here? There doesnt seem to be a one-to-one mapping between Java and .Nets format strings. Should I limit the possible formats to a selection I know I can represent fully in both .Net and Java?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET