DateTimeAndTimeZone - noresources/ns-php-sql GitHub Wiki

Date, time and time zone handling

Terminology

  • A "timestamp column" is a table column with a Date/Time affinity. Ex: DATE, TIME, DATETIME
  • A timestamp string is a literal representation of a date

Serialization behavior

  • A value inserted to a timestamp column without time zone support will be translated to a timestamp string without time zone part but following the same time zone as the DBMS server time zone. Ex: if DBMS time zone is UTC, the value "2010-11-12T13:14:15+0100" will be inserted as "2010-11-12T12:13:14"
  • A value inserted to a timestamp column with time zone support will be to a timestamp string with time zone specifier

Deserialization behavior

  • All timestamp-like column value will be unserialized as DateTimeInterface object
  • DateTimeInterface instance time zone will be set tue PHP default time zone

Notes

SQLite

SQLite does not have a real DATETIME-like type but have several time manipulation function that works with ISO 8601 timestamps.

ns-php-sql assumes that all entry without explicit time zone are UTC-related.

MySQL

MySQL does not have any type that supports a time zone specifier.