PostgreSQL 时间类型
Less than 1 minute
首先,postgre 并没有 datetime 类型,只有如下这些类型。
| Name | Storage Size | Description | Low Value | High Value | Resolution |
|---|---|---|---|---|---|
timestamp [ (*p*) ] [ without time zone ] | 8 bytes | both date and time (no time zone) | 4713 BC | 294276 AD | 1 microsecond |
timestamp [ (*p*) ] with time zone | 8 bytes | both date and time, with time zone | 4713 BC | 294276 AD | 1 microsecond |
date | 4 bytes | date (no time of day) | 4713 BC | 5874897 AD | 1 day |
time [ (*p*) ] [ without time zone ] | 8 bytes | time of day (no date) | 00:00:00 | 24:00:00 | 1 microsecond |
time [ (*p*) ] with time zone | 12 bytes | time of day (no date), with time zone | 00:00:00+1559 | 24:00:00-1559 | 1 microsecond |
interval [ *fields* ] [ (*p*) ] | 16 bytes | time interval | -178000000 years | 178000000 years | 1 microsecond |
在 python 的
SQLAlchemy框架中,DATETIME类型对应PostgreSQL的timestamp without time zone
