How to get Date and Time from Timestamp in DB2

Extracting the date and time independently from a timestamp in an easy way:

Current Time and Date

Example-1

current timestamp
TIME (current timestamp)

Calculations of Date and Time

You can also perform date and time calculations :

Example -2

current date + 1 YEAR
current date + 3 YEARS + 2 MONTHS + 15 DAYS
current time + 5 HOURS - 3 MINUTES + 10 SECONDS

Advertisements