开发者

Will the MySQL datetime format work with SQLite and PostgreSQL?

开发者 https://www.devze.com 2022-12-17 04:39 出处:网络
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.

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消