鉴于我在 postgresql 中有一个带有 created_at 列的签入表,我将如何在考虑时区'America/New_York'
(并考虑到夏令时)?
目前我正在执行以下查询,psql (PostgreSQL) 9.1.6
但它似乎缺少一些在一天结束时添加的记录。
SELECT COUNT(*) AS count FROM checkins WHERE date(created_at) = '2012-10-17';
这是给定日期的所有记录的列表。上面的查询返回 10,这是不正确的。我应该回到13。
id | waiver_id | created_at | updated_at
------+-----------+----------------------------+----------------------------
1391 | 1 | 2012-10-18 00:42:07.308453 | 2012-10-18 00:42:07.308453
1390 | 286 | 2012-10-18 00:38:53.102685 | 2012-10-18 00:38:53.102685
1389 | 590 | 2012-10-18 00:38:28.811605 | 2012-10-18 00:38:28.811605
1388 | 7 | 2012-10-17 22:29:25.610774 | 2012-10-17 22:29:25.610774
1387 | 1155 | 2012-10-17 22:01:40.647219 | 2012-10-17 22:01:40.647219
1386 | 1154 | 2012-10-17 22:00:05.477698 | 2012-10-17 22:00:05.477698
1385 | 1153 | 2012-10-17 21:57:59.698076 | 2012-10-17 21:57:59.698076
1384 | 1152 | 2012-10-17 21:08:32.533203 | 2012-10-17 21:08:32.533203
1383 | 1151 | 2012-10-17 21:07:42.500036 | 2012-10-17 21:07:42.500036
1382 | 115 | 2012-10-17 21:04:03.075333 | 2012-10-17 21:04:03.075333
1381 | 3 | 2012-10-17 20:30:13.741647 | 2012-10-17 20:30:13.741647
1380 | 245 | 2012-10-17 20:29:53.808852 | 2012-10-17 20:29:53.808852
1379 | 1150 | 2012-10-17 20:27:30.057269 | 2012-10-17 20:27:30.057269
签入列和数据类型
column_name | data_type
-------------+-----------------------------
updated_at | timestamp without time zone
created_at | timestamp without time zone
waiver_id | integer
id | integer