Hi,
I’m trying to compare a timestamp to current_timestamp but I’m having trouble.
I want to compare just the date piece of my timestamp column to just the date piece of current_timestamp.
I’m getting weird results that I don’t understand.
When I use TO_DATE it changes the year, month, etc.
Any ideas?
anna=> SELECT request_date,TO_DATE(request_date,'YYYY-MM-DD HH24:MM:SS') FROM anna_onestop_database_t ; request_date | to_date
---------------------+------------
2003-10-08 09:15:57 | 2004-03-09
2003-10-08 09:18:37 | 2004-06-09
2003-10-08 09:20:11 | 2004-08-09
2003-10-08 09:27:56 | 2005-03-11
2003-10-08 09:30:38 | 2005-06-11
2003-10-08 09:32:09 | 2005-08-11
2003-10-08 09:47:07 | 2006-11-13
2003-10-08 10:04:22 | 2003-04-08
2003-10-08 11:46:37 | 2006-10-14
2003-10-08 12:08:41 | 2003-08-08
2003-10-08 12:21:52 | 2004-09-09
2003-10-08 12:42:27 | 2006-06-13
2003-10-08 13:13:53 | 2004-01-08
anna=> SELECT TO_DATE(request_date,'MM/DD/YYYY'),TO_DATE(current_timestamp,'MM/DD/YYYY') FROM anna_onestop_database_t WHERE TO_DATE(request_date,'MM/DD/YYYY') > TO_DATE(current_timestamp,'MM/DD/YYYY');
to_date | to_date
------------+------------
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0181-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0182-10-03 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
0183-10-04 | 0180-10-26
thanks!
Troy Campano