Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Convert a Time in (HH:MM:SS AM/PM) format to 24 hours format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Sivagurunathan Jagadeesan

New User


Joined: 06 Mar 2007
Posts: 32
Location: India

PostPosted: Tue Mar 13, 2007 12:10 pm    Post subject: Convert a Time in (HH:MM:SS AM/PM) format to 24 hours format
Reply with quote

Hi,

I am working in Enterprise COBOL and DB2 in Mainframes.

How do i convert a Time in (HH:MM:SS AM/PM) format to 24 hours format(HH:MM:SS). I tried using the ALTTIME function but the Schema DSN8 which this functions belongs to, is not working.

Thanks in Advance,
Siva
Back to top
View user's profile Send private message

wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Wed Mar 14, 2007 6:10 am    Post subject:
Reply with quote

When you say 'not working', what kind of error message you get?
Back to top
View user's profile Send private message
Sivagurunathan Jagadeesan

New User


Joined: 06 Mar 2007
Posts: 32
Location: India

PostPosted: Wed Mar 14, 2007 7:19 am    Post subject: Re: Convert a Time in (HH:MM:SS AM/PM) format to 24 hours fo
Reply with quote

Hi,

The fuction ALTTIME is not recognized as an valid one. Message says "ALTTIME" is not a valid function.

Thanks,
Siva
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Wed Mar 14, 2007 8:52 am    Post subject: Re: Convert a Time in (HH:MM:SS AM/PM) format to 24 hours fo
Reply with quote

Check in SYSIBM.SYSROUTINES for an entry of ALTTIME function with DSN8. It is probably not there. You can talk to your DBAs to make that available.

Otherwise, as far as I understand, DB2 doesn't have any builtin function that can take in a time format like HH:MM:SS AM/PM

There is one HH:MM AM/PM however, if you are willing to sacrifice the 'SS'.
Back to top
View user's profile Send private message
Sivagurunathan Jagadeesan

New User


Joined: 06 Mar 2007
Posts: 32
Location: India

PostPosted: Wed Mar 14, 2007 9:56 am    Post subject: Re: Convert a Time in (HH:MM:SS AM/PM) format to 24 hours fo
Reply with quote

Hi,

Thanks for your inputs, I'll check in SYSROUTINES.
Used a query like this,
EXEC SQL
SELECT
(RIGHT('00'||RTRIM(CHAR(HOUR(IN_TIME))),2) ||
'.' ||
RIGHT('00'||RTRIM(CHAR(MINUTE(IN_TIME))),2) ||
'.' ||
RIGHT('00'||RTRIM(CHAR(SECOND(IN_TIME))),2))
END-EXEC.

The INTIME is in HH:MM:SS AM/PM format, above query converts it to 24hrs format.

Thanks,
Siva
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Wed Mar 14, 2007 11:45 am    Post subject:
Reply with quote

Hmm..the HOUR function is not supposed take a TIME format with HH:MM:SS AM/PM as input as far as the manual says. But then if it works for you, great!

And thanks to you, I tried out the ALTTIME function. icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format issues using XMITIP MSGDD ssdjp1 CLIST & REXX 3 Mon Oct 23, 2017 8:47 pm
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us