Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to convert DATE datatype to TIMESTAMP datatype?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Thu Sep 27, 2007 10:28 am    Post subject: How to convert DATE datatype to TIMESTAMP datatype?
Reply with quote

Hi All,

I had one question, Can i convert the DATE datatype in DB2 to TIMESTAMP datatype, by making use of some function?
Early response would be appreciated.

Regards
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Sep 27, 2007 11:05 am    Post subject:
Reply with quote

leo_sangha,

This might help you -

http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0000860.htm
Back to top
View user's profile Send private message
mbr_raja

New User


Joined: 15 Nov 2004
Posts: 26
Location: Chennai, India

PostPosted: Fri Sep 28, 2007 1:04 pm    Post subject: Reply to: How to convert DATE datatype to TIMESTAMP datatype
Reply with quote

You can try to use the function Timestamp to convert given date into timestamp format.

TIMESTAMP (START_DATE, START_TIME)
for ex: TIMESTAMP('2007-09-28',' ')

the output will be timestamp format as 2007-09-28-00.00.00.000000
Back to top
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Mon Oct 01, 2007 9:51 am    Post subject: Reply to: How to convert DATE datatype to TIMESTAMP datatype
Reply with quote

Hello Murmohk,

I tried TIMESTAMP_ISO function but i guess we might have previous version of DB2 installed, i am getting the below error:

DSNT408I SQLCODE = -440, ERROR: NO FUNCTION BY THE NAME TIMESTAMP_ISO HAVING COMPATIBLE ARGUMENTS WAS FOUND IN THE CURRENT PATH

below is the SQL i am using
SELECT * FROM TABLE
WHERE UPDATE_TIMESTAMP >
TIMESTAMP_ISO('2007-09-9');

Do you have any idea about this ?

mbr_raja


i tried your solution it is giving me below error:

SELECT * FROM TABLE
WHERE UPDATE_TIMESTAMP >
TIMESTAMP('2007-09-18','-00.00.00.000000');

DSNT408I SQLCODE = -180, ERROR: THE DATE, TIME, OR TIMESTAMP VALUE *N IS INVALID

Could you please share the SQL with me which you executed?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Oct 01, 2007 5:55 pm    Post subject:
Reply with quote

You could use
Code:
where update_timestamp > '2007-09-18-
00.00.00.000000'


or the slightly less efficient
Code:
where date(update_timestamp) > '2007-09-18'
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 8 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us