Question: I guess there are two major approaches to date representations in XML:

```
<date>1984-10-27</date>

```

and 

```
<date>
  <year>1984</year>
  <month>10</month>
  <day>27</day>
</date>

```

Personally I would go for the former. It's more compact and at the same time more readable. The split-up of the second form seems overkill to me; e.g. most of the time the month in itself will have no information value.

Also you can't validate an element like <day> independently: you can define a range of [1..31], but 31 isn't acceptable if <month> is 2.

On the other hand the first form could cause confusion, especially if you use (FFF) MM-DD-YYYY or DD-MM-YYYY. I always use ISO 8601 format (YYYY-MM-DD), as it avoids this confusion.

Which XML code do you prefer?

Answer: 
The standard for dates/times in xml is much more formal than that; most xml parsers will respect (for example):

* 2009-02-15
* 2009-02-15T10:20:34.0000000
* 2009-02-15T10:20:34.0000000+00:00

This is always yyyy-MM-dd; the time portion is optional, as is the UTC offset.

(edit: [lucas-insasho](https://stackoverflow.com/questions/550467/date-elements-in-xml/550482#550482) correctly cited the [spec](http://www.w3.org/TR/NOTE-datetime))
While I agree with lucas-insasho that seconds-since-epoch is generally the easiest date/time representation to work with, it's not generally the easiest one to work with in XML. It can't be usefully processed by XSLT 1.0, nor can it be validated using XML Schema. 

You can of course represent data in XML however you want. But really the only reason to use XML in the first place (instead of a more lightweight serialization format like JSON or YAML) is to reap those benefits that standardization has to offer.