Query for Getting the Current Date

Asked By 20 points N/A Posted on -
qa-featured

Hi there!

I need somebody to please tell me how to get the current date?

I will compare my record to the current record?

What is the query for it?

Thanks.

SHARE
Answered By 5 points N/A #100823

Query for Getting the Current Date

qa-featured

Hi Morblack,

You have to pick from these queries to get the current date, time, and timestamp using SQL.

Just pick the ones that will suit your needs.

SELECT current date FROM sysibm.sysdummy1 // mm/dd/yyyy

SELECT current time FROM sysibm.sysdummy1 // hh.mm.ss

SELECT current timestamp FROM sysibm.sysdummy1 // yyyy-mm-dd-hh:mm:ss.ms //milliseconds

Or better off you can do it by directly executing the queries below.

VALUES current date

VALUES current time

VALUES current timestamp

You mean you want to compare a specific time against the date time value from a database record?

You may want to take a look at this link.

I hope it helped.

 

 

Related Questions