Jot*_*Rod 1 postgresql flot unix-timestamp
我试图使用FLOT图表绘制我存储在PostgreSQL中的值.其中一个轴将有时间戳.我将其存储在数据库中的格式为:( 2013-11-01 00:05:57年 - 月 - 日小时:分:秒).
我尝试使用以下代码将此格式转换为UNIX:
$postgresql_timestamp= 2013-11-01 00:05:57;
$unix_timestamp= strtotime($postgresql_timestamp);
Run Code Online (Sandbox Code Playgroud)
得到的结果1383260757与另一个日期相对应:2013-10-01 23:05:5
我认为我遇到的问题与PostgreSQL上的时间戳格式有关.
PostgreSQL支持标准SQL的extract()功能,可以将SQL时间戳转换为Unix时间戳.
select extract(epoch from timestamp '2013-11-01 00:05:57');
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4716 次 |
| 最近记录: |