How to get Date and Time from Timestamp in DB2

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

Example-1

1
2
DATE (current timestamp)
TIME (current timestamp)

You can also perform date and time calculations :

Example -2

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

More:

Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.