Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us