views:

158

answers:

3

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?

+1  A: 

Yes for Postgres.

Milen A. Radev
+1  A: 

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)

MarkR
SQLite does support different data types, including nulls, numbers, strings, floats, blobs, etc.
Roger Pate
+2  A: 

SQLite uses several date formats; PostgreSQL uses similar formats and more.

Both understand YYYY-MM-DD HH:MM:SS.

Roger Pate