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))
I vote for broken up. Whats wrong with the first you ask?

* is that day/month or month/day ...errors are likely both human and machine
* needs to be tokenized to get out the date information
* you are storing formatting(separator) characters