tags:

views:

374

answers:

2

Across various SQL dialects, what string representation for a Date and/or DateTime would be most likely to be interpreted correctly? Is there an SQL Standard? Are the two answers identical or similar?

EDIT:

For suggestions, can we all please comment with any known SQL dialects that don't comply?

+6  A: 

I would bet the ISO 8601 date time standard would most likely be the one.

'YYYY-MM-DDThh:mm:ssTZD'

Or maybe a slight variation:

'YYYY-MM-DD hh:mm:ss'

http://www.w3.org/TR/NOTE-datetime

Andy White
+1  A: 

If you want to be portable across databases, maybe you should consider abstracting everything away using something like ADO or OTL. Pretty much all databases support ODBC connections, and you could just use something like OTL's datetime container to write and read dates.