Will the MySQL datetime format work with SQLite and PostgreSQL?
In MySQL you enter dates (datetime
field) in the format 2009-10-16 21:30:45
. Which makes it simple to insert times into the database.
$date = date('Y-m-开发者_开发百科d H:i:s', $timestamp);
Will this format work with SQLite and PostgreSQL? If not, what format do they use?
SQLite uses several date formats; PostgreSQL uses similar formats and more.
Both understand YYYY-MM-DD HH:MM:SS.
Yes for Postgres.
As Sqlite doesn't support different data types, yes you can definitely use it. iso-8601 dates have the big advantage that they sort lexically (unlike, for example, US dates)
精彩评论