Results 1 to 4 of 4
  1. #1
    Join Date
    May 2009
    Posts
    11

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The reason is because those are not valid character representations of a timestamp.

    Andy

  3. #3
    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

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •