After executing this SQL in oracle 10g:
SELECT SYSDATE, CURRENT_TIMESTAMP FROM DUAL
I receive this strange output:
What is cause of the difference in time? The server time is equal of SYSDATE value
SYSDATE will give the system date of the server. CURRENT_DATE will give you the system date of the session. For example, if your oracle server is in UK, the SYSDATE will be the UK time whereas, the CURRENT_DATE will be the Indian time.
CURRENT_TIMESTAMP is an ANSI SQL function whereas GETDATE is the T-SQL version of that same function. One interesting thing to note however, is that CURRENT_TIMESTAMP is converted to GETDATE() when creating the object within SSMS. Both functions retrieve their value from the operating system in the same way.
SYSDATE: Show the date and time of the database server. CURRENT_DATE: Show the date and time of the session timezone. SYSTIMESTAMP: Shows the date and time of the database server, in a TIMESTAMP WITH TIME ZONE data type.
SYSTIMESTAMP returns current timestamp on database server, while current_timestamp returns current timestamp on client machine. So if your database server is in New York and client box is in California, SYSTIMESTAMP will be 3 hours ahead of CURRENT_TIMESTAMP.
CURRENT_DATE
and CURRENT_TIMESTAMP
return the current date and time in the session time zone.
SYSDATE
and SYSTIMESTAMP
return the system date and time - that is, of the system on which the database resides.
If your client session isn't in the same timezone as the server the database is on (or says it isn't anyway, via your NLS settings), mixing the SYS*
and CURRENT_*
functions will return different values. They are all correct, they just represent different things. It looks like your server is (or thinks it is) in a +4:00 timezone, while your client session is in a +4:30 timezone.
You might also see small differences in the time if the clocks aren't synchronised, which doesn't seem to be an issue here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With