IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Custom formatting of timestamp.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Oct 15, 2009 1:40 pm
Reply with quote

Hi

i need to select the timestamp as YYYYMMDDhhmmss format. can any one tell me how to format the timestamp using db2 query.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 15, 2009 1:52 pm
Reply with quote

Arvind,

Thru SUBSTR and various DATE-TIME columnar functions you could have db2 return your formated timestamp.

I imagine that it would be faster to to SELECT/SET your 26 char host variable with a 'normal timestamp' and then create your format thru MOVE statements.
Back to top
View user's profile Send private message
arvind.m

Active User


Joined: 28 Aug 2008
Posts: 205
Location: Hyderabad

PostPosted: Thu Oct 15, 2009 2:27 pm
Reply with quote

Thank you Dick. i got it using SUBSTR,CHAR and then concatinating all the fields to get as required format.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Need help on formatting a report DFSORT/ICETOOL 14
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts Rexx formatting CLIST & REXX 2
No new posts Timestamp difference and its average ... DB2 11
Search our Forums:

Back to Top