时间在postgres服务器和excel中有所不同
我正在尝试一个按月分组数据的查询。
test_db=# select date_trunc('month', install_ts) AS month, count(id) AS count from api_booking group by month order by month asc; month | count ------------------------+------- 2016-08-01 00:00:00+00 | 297 2016-09-01 00:00:00+00 | 2409 2016-10-01 00:00:00+00 | 2429 2016-11-01 00:00:00+00 | 3512 (4 rows)
这是我的postgres数据库shell的输出。
如何,当我在Excel中尝试这个查询,这是输出,
month | count ------------------------+------- 2016-07-31 17:00:00+00 | 297 2016-08-31 17:00:00+00 | 2409 2016-09-30 17:00:00+00 | 2429 2016-10-31 17:00:00+00 | 3512 (4 rows)
问题是我认为excel是在不同的时区理解date格式。 那么,我如何告诉excel正确读取? 或任何解决这个问题?
尝试…
select date(date_trunc('month', install_ts)) AS month, count(id) AS count from api_booking
date()从时间的date中去掉时间。