View Full Version : SQL Current Time
SNYP40A1
September 26th, 2007, 06:58 PM
I have a SQL script that pulls data including a column that has a timestamp. I want to only show timestamps from the last day. How do I do that? I tried using SYSTIMESTAMP (using Oracle 9i), but that did not work.
Martin Witte
September 26th, 2007, 07:25 PM
suppose your column is called timestamp and your table is called timestampeddata you could go for 'select * from timestampeddata where trunc(timestamp) = trunc(sysdate)'
CptPicard
September 26th, 2007, 07:31 PM
In PostgreSQL I use ... where now()-timestamp < '1 day'. You might want to look into how Oracle expresses time intervals and what the corresponding function to now() is :)
SNYP40A1
September 26th, 2007, 08:36 PM
suppose your column is called timestamp and your table is called timestampeddata you could go for 'select * from timestampeddata where trunc(timestamp) = trunc(sysdate)'
Yup, this works perfectly:
trunc(sysdate) < trunc(ts.end_date)+1
Thanks!
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.