Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Most portable SQL date string format

Tags:

date

sql

datetime

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?

like image 538
dkretz Avatar asked Jan 23 '23 17:01

dkretz


1 Answers

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

like image 190
Andy White Avatar answered Feb 02 '23 10:02

Andy White