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 > Timestamp format

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-06, 15:42
dollar489 dollar489 is offline
Registered User
 
Join Date: Sep 2002
Posts: 456
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.
Reply With Quote
  #2 (permalink)  
Old 05-16-06, 16:17
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #3 (permalink)  
Old 05-17-06, 07:59
dollar489 dollar489 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 05-17-06, 08:06
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
varchar(timestamp) should be close.

Andy
Reply With Quote
  #5 (permalink)  
Old 05-17-06, 23:59
Daniel-D Daniel-D is offline
Registered User
 
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.
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