Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Posts
    456

    Unanswered: Timestamp format

    One running a query for a Timestamp field in the new DB2 V8 Command center, we get the result as Oct 10, 2005 10:46:06 AM 000000.

    I could not find any setting in the tool, which would allow me to configure the timestamp output in the format yyyy-mm-dd-hh:mm:ss:ssssss. Can anyone help to see if the tool can be configured to give results in the desired format.

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I believe that what you are seeing is the java representation of a timestamp. The command center sees that the column is a timestamp and uses java.sql.Timestamp for the object Class for that column. If you want something else, just change your query to format it using a function.

    HTH

    Andy

  3. #3
    Join Date
    Sep 2002
    Posts
    456
    Can you suggest any function which can accomplish this. I looked at most of the functions in DB2 but could not find one which can get the required resultset. Thanks

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    varchar(timestamp) should be close.

    Andy

  5. #5
    Join Date
    Apr 2006
    Posts
    8
    You can use function TIMESTAMP_ISO to get a ISO Formated timestamp:
    db2 => values( current timestamp)

    1
    --------------------------
    2006-05-18-11.35.12.348338

    db2 => values( TIMESTAMP_ISO (current timestamp))

    1
    --------------------------
    2006-05-18-11.37.16.347539

    1 条记录已选择。

    db2 =>

    Also You can use TIMESTAMP_FORMAT function to a user-defined format.

Posting Permissions

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