MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TIMESTAMP

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Tue Oct 14, 2003 12:14 am    Post subject: TIMESTAMP Reply with quote

Hi,
I would like to know how to truncate the TIMESTAMP (i.e i want to remove microseconds part) and define it as a column for a table.

I tried using
DOJ TIMESTAMP CHAR(19) NOT NULL,
but this does not work.

Is there any alternative for this.
Back to top
View user's profile Send private message
vani
Beginner


Joined: 28 May 2003
Posts: 51
Topics: 30

PostPosted: Tue Oct 14, 2003 3:58 am    Post subject: Reply with quote

I want to retrieve date and time at a stretch but i don't want microseconds
This should produce a single column
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Tue Oct 14, 2003 4:46 am    Post subject: Reply with quote

vani,


Try these

Code:

 SELECT CHAR(DATE(TIMESTAMP)) CONCAT           
        CHAR('-')              CONCAT
        CHAR(TIME(TIMESTAMP))                 
   FROM TABLE                               
 ;   

OR
Code:
                                           
 SELECT SUBSTR(CHAR(TIMESTAMP),1,19)           
   FROM TABLE                               
 ;                                             


Both of these queries will produce the value with date and time seperated by a '-'

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group