Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 比较随时间戳变化的字符_Sql_Postgresql_Timestamp_To Timestamp - Fatal编程技术网

Sql 比较随时间戳变化的字符

Sql 比较随时间戳变化的字符,sql,postgresql,timestamp,to-timestamp,Sql,Postgresql,Timestamp,To Timestamp,我试图比较postgresSQL中随时间戳变化的字符 我想获得当前时间之前的所有值,与字符变化时间戳进行比较 这个比较正确吗 WHERE to_timestamp('2018-12-25T06:00:00+01:00', 'YYYY-MM-DD HH24:MI:SS') < now() 时间戳('2018-12-25T06:00:00+01:00','YYYY-MM-DD HH24:MI:SS')

我试图比较postgresSQL中随时间戳变化的字符

我想获得当前时间之前的所有值,与字符变化时间戳进行比较

这个比较正确吗

WHERE to_timestamp('2018-12-25T06:00:00+01:00', 'YYYY-MM-DD HH24:MI:SS') < now()
时间戳('2018-12-25T06:00:00+01:00','YYYY-MM-DD HH24:MI:SS')不完全是这样。文本中有应该解析的时区值。比较:

select
    to_timestamp('2018-12-25T06:00:00+01:00', 'YYYY-MM-DD HH24:MI:SS') as "seems ok",
    to_timestamp('2018-12-25T07:00:00+02:00', 'YYYY-MM-DD HH24:MI:SS') as "but this is wrong!",
    to_timestamp('2018-12-25T06:00:00+01:00', 'YYYY-MM-DD HH24:MI:SS+TZH:TZM') as "ok",
    to_timestamp('2018-12-25T07:00:00+02:00', 'YYYY-MM-DD HH24:MI:SS+TZH:TZM') as "ok too"

        seems ok        |   but this is wrong!   |           ok           |         ok too         
------------------------+------------------------+------------------------+------------------------
 2018-12-25 06:00:00+01 | 2018-12-25 07:00:00+01 | 2018-12-25 06:00:00+01 | 2018-12-25 06:00:00+01
(1 row)