If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Need to get Timestamp from Varchar

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-05-09, 12:09
funnyme.25 funnyme.25 is offline
Registered User
 
Join Date: May 2009
Posts: 11
Need to get Timestamp from Varchar

HI,

Im unable to cast VARCHAR(200) to timestamp.

Input varchar is - 1241523008248,1241523008602 etc

Need to convert these inputs to Timestamp like

2009-05-05 07:30:37.577885,2009-05-05 07:30:42.551349 etc

cast(t.timestampis as timestamp) something...

Please advise
Reply With Quote
  #2 (permalink)  
Old 05-05-09, 12:46
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The reason is because those are not valid character representations of a timestamp.

Andy
Reply With Quote
  #3 (permalink)  
Old 05-05-09, 12:56
funnyme.25 funnyme.25 is offline
Registered User
 
Join Date: May 2009
Posts: 11
What can be cast to timestamp.
How to get this output then?
Can i convert to numeric and then cast to timestamp

OR a way directly get timestamp from xml
Reply With Quote
  #4 (permalink)  
Old 05-05-09, 13:07
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Read the manual on casting between data types:

IBM DB2 9.5 Information Center for Linux, UNIX, and Windows

If this is related to your other 2 posts, then you data is a numeric that represents the number of milliseconds from 01/01/1970 00:00:00. If this is correct, then the threads on your other posts will get you where you want to go.

Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On