Informix Date conversion

Posted: March 12, 2014 in Database
Tags: , , , , , , ,

When we store time stamp in database the column can be of type DATE TIME YEAR TO SECOND .

It Will contain day of month, month, year, time in seconds. But usually the scenarios that we Will be handling Will be pull all the data that happened this year or pull all the data that happened on particular date

on these scenarios we need to extract the columns from time stamp data.

here is the list of keywords

Day
Month
Year
Date

select DAY(activity_date) from table .

select MONTH(activity_date) from table.

select YEAR(activity_date) from table.

select DATE(activity_date) from table

say the timestamp is
2014-03-05 13:17:40

queries will return

5
3
2014
03/05/2014

Advertisements

Comments are closed.