Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localising date format descriptors

Tags:

What is the best way to localise a date format descriptor?

As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation support, so it's trivial to parse dates according to the users culture, but you often want to also display a helpful hint as to the format required (especially to distinguish between yy and yyyy which is interchangeable in most cultures).

What is the best way to do this in a way that make sense to most users (e.g. dd/M/yyy is confusing because of the change in case and the switching between one and two letters).

like image 362
ICR Avatar asked Aug 03 '08 17:08

ICR


People also ask

How do I localize a date?

For instance, in the US, they specify the month first, followed by the day, and then the year. Each component is also separated with a slash, which gives us mm/dd/yyyy , for example: 09/01/2021 , which would be September 1, 2021.


2 Answers

Just use ISO-8601. It's an international standard.

Date and time (current at page generation) expressed according to ISO 8601: Date:                           2014-07-05 Combined date and time in UTC:  2014-07-05T04:00:25+00:00                                 2014-07-05T04:00:25Z Week:                           2014-W27 Date with week number:          2014-W27-6 Ordinal date:                   2014-186 
like image 92
engtech Avatar answered Oct 03 '22 22:10

engtech


I have to agree with the OP 'wrong' dates really jar with my DD/MM/YYYY upbringing and I find ISO 8601 dates and times extremely easy to work with. For once the standard got it right and engtech has the obvious answer that doesn't require localisation.

I was going to report the birthday input form on stack overflow as a bug because of how much of a sore thumb it is to the majority of the world.

like image 40
sparkes Avatar answered Oct 03 '22 20:10

sparkes