Hi Team,
I did a tests on to_date and to_timestamp.
The test env is in EST(UTC-5) timezone:
# date
Tue Feb 17 14:59:23 EST 2015
The finding is to_date is treating the timestamp as UTC.
So to_date may show one day before to_timestamp.
Even if I specify timezone in to_timestamp, it still does not work.
Is this expected behavior or bug?
> select to_date(to_timestamp('2012-02-04 04:59:59','YYYY-MM-dd HH:mm:ss'
)) from sys.version;
+------------+
| EXPR$0 |
+------------+
| 2012-02-03 |
+------------+
1 row selected (0.118 seconds)
> select to_date(to_timestamp('2012-02-04 05:00:00','YYYY-MM-dd HH:mm:ss'
)) from sys.version;
+------------+
| EXPR$0 |
+------------+
| 2012-02-04 |
+------------+
1 row selected (0.074 seconds)
==
> select to_date(to_timestamp('2012-02-04 04:59:59 EST','YYYY-MM-dd
HH:mm:ss z' )) from sys.version;
+------------+
| EXPR$0 |
+------------+
| 2012-02-03 |
+------------+
1 row selected (0.1 seconds)
Thanks,
Hao