WordProcessingML and the ISO 8601 Date

When I do a title like this, I want to include audio that does the dramatic organ sound, "Dah, dah, DAH!"- you know, kind of scary like. Why a little scary? Here's the deal: I'm all about using custom XML schemas for my Word or Excel documents, but there are a few irksome issues, dates in schemas being one of them. If you are new to Office and XML, in the words of Morpheus: Welcome to the real world.

Now, one of the hang-ups I have with using ISO 8601 compliant XML schemas is that the date datatype requires that dates be formatted this way: YYYY-MM-DD. The logic here (and it's good) is that to help XML live up to its promise of universal data exchange, we should all standardize around a universal date format.

But, the world doesn't work this way. This date format is just not the what a lot of business exchanges expect. Sure, we can run off on a tangent about ethnocentrism (big topic when I was in my Ph.D. courses), but I think it has less to do with sinister selfishness and arrogance and more to do with the adage that simply old habits die hard. As Natalie Merchant says, "Give 'em what they want." So, if you attach your fully compliant XSD with the date datatype in it to a Microsoft Word 2003 document, you will see this (structured pane on top, with what the user sees in the doc below):

So, if you feel like you have sufficient clout in your company to impose the date format from your developer desk cluttered with soda cans and Visio diagram print outs, go for it (European's, though their desks are just as cluttered, are cool with the format already, so there is less of an issue- except with doing business across the pond!).

What are your options?

1) Don't use the xsd:date format. Go with a string.

2) Use XSL to transform dates after the fact. For example, we include a function, ms:date-format() to do this sort of thing

3) Create your own type for dates in the schema. Kirk Allen discusses this in a blog post wherein he discusses the merits of some of the issues. It's a good read, and he links to Oleg's blog (no shock there). Both great blogs.


4) Click your heels three times and say, "There's no place like home"

In any case, these are things you need to think through. Intriguingly, I had been preparing this post last Friday when I was contacted by Catherine Heller (Tech Evangelist Extraordinaire) to see if I wanted to present some stuff around these various issues at an up-coming event. Strange coincidence. She's cool.

 Rock Thought for the day: 1971- That's when the song Planet Caravan, was released by Black Sabbath. If you have never heard it, give it a listen. It still holds up after all these years (34!). The strong affinity with the era that brought us Pink Floyd and others is clear. The vocals are saturated and dreamy. The lyrics are nothing scary: just a ride toward the planet mars, hazy skies, psychedelic thoughts. It's a song that has been too often overlooked.

Rock On

Comments (3)

  1. Matthew says:

    This is a good point well made and despite being a UK based developer dates have given me no end of trouble through the years.

    I am therefore eternally grateful to those w3c guys for addressing the issue so precisely with xsd:date and to pick up on your point about old habits (so true!) – the sooner you adopt xsd:date the sooner it becomes an old habit.

  2. Thanks, Matthew! True enough- adopting the standard would start a new habit. I suppose we will get there about the same time we adopt the metric system in earnest! I remember in the 70’s when I was in school that the teachers would wax prophetic and describe how in just a handful of years, the US would be completely converted over to the metric system. It seems so quaint to me now.

    You know, my father is an experienced craftsman, and he can do amazing work with wood. I have seen him cut boards the proper length without measuring. He just knows how long 18 inches is and so forth. It’s an amazing skill. Ask him to cut a plank that is 30 cm? Nope. He’s a talented guy.

Skip to main content