Minimal IT logo and link to home page
Research, training, consultancy and software to reduce IT costs
Home | About | Newsletter | Contact
Previous | Next Printer friendly
14 May 2013

Dates and numbers

By Andrew Clifford

There is a surprising lack of standards for date and number formats.

I have been adding date and number formatting to our Metrici platform.

The basic routines to format a date, time or number are well established. However, our requirements are a bit more involved. We want to declare a format for a piece of data, and then to both view and amend the data in that format.

We decided to add browser-based processing to format dates and numbers as they are displayed on the page, and to format them back to their internal representations before they are sent back to the server. This means that we don't complicate the underlying data storage. It also means that it is easy to pass the formats to browser components, such as date selectors or numeric edit fields.

The simplest solution seemed to be to tag the data (using a CSS class) with its internal format (date, number) and also with the particular format that would make sense for the user, such as a formatted date or an amount of money. This means we can easily support customers in multiple countries.

We thought it would be a good idea to adopt standards to identify different date and number formats. There are plenty of similar standards – for languages, fonts, character sets, keyboards – so I thought they must exist for dates and numbers. Then we could either adopt routines that use these, or base our own routines around a well-established standard.

For anything like this, a quick search on the Internet soon finds what you want. So I searched, and searched, but I could not find any standards for identifying number and date formats. I found two related things, but neither are what I want.

I found plenty of different conventions for specifying the formats of dates and numbers. For example, formatting a date like "14 May 2013" is specified as "d M yy" in the jQuery library, but "d MMM yyyy" in the Datejs library. Formatting a number like "1,234.56" is specified as ###,##0.00" in many BASIC-based languages, but as the object {aSep:',',dGroup:'3',aDec:'.',vMax:'999999.99',vMin:'000000.00',mRound:'S',aPad:true} in the very comprehensive autoNumeric library.

I also found lots of different standards for representing dates, times and numbers, like Internet standard RFC 822's date times such as "Tue, May 14 2013 08:00 +01:00".

Finding things I didn't want helped me understand what I do want. I want a standard identifier for something like "Slovakia Short Numeric Date" or "USA Written Date". Codes like this would make it easy to select what format I want to show the user. But I could not find any such standard, and in the end, I had to come up with some identifiers for our own immediate needs, such as "en-little-endian-short" for dates like "14 May 2013", or "gbp-rounded" for a currency figure such as "£1,234.56".

Maybe I am imagining a solution to a problem that other people don't have, but I think the lack of standard identifiers for date, time and number formats is surprising. It is not addressed by the current plethora of formatting conventions and competing representation standards. If anyone has found standard identifiers for date and number formats, let me know. Standards bodies, we need another standard.

Next: It's not meant to be hard

Subscription

Subscribe to RSS feed

Latest newsletter:
Magical metadata

We use the term "metadata-driven" to describe IT solutions in which functionality is defined in data. Taking this to the extreme can provide unparalleled levels of speed, simplicity and versatility.
Read full newsletter

System governance

System governance helps you implement high-quality systems, manage existing systems proactively, and improve failing systems.

Find out more