views:

42

answers:

2

I have a script which outputs a CSV file. How should I format dates or date+time fields so that Excel will correctly parse that field as a date?

PS: I'd like to keep timezone information intact as well.

A: 

I would use the "dd/mm/yyyy hh:nn:ss" format. I have never had any problems with Excel understanding this format before.

Craig T
How about timezones?
nickf
Timezone would have to be added as a separate column.
Craig T
+1  A: 

Excel's date format does not contain any information about time zones. I would export the time zone as a separate column, perhaps as an offset from GMT, like 5 or -2. I personally prefer the unambiguous yyyy-mm-dd date format.

+5, or -2 to what?
nickf
+5 or -2 to Greenwich Mean Time (GMT), so for example, Eastern Standard Time would be -5 to GMT, whereas Paris would be +1.
well that's what I mean, how would anyone know?
nickf
Since in your question you say you would like to keep timezone information intact, I assume this information exists in your source data. In what format is your timezone data?