Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

rsvebeck
Not applicable

Convert a timestamp from 12 hr to 24 hr in script

Hi

I have a textfile containing timestamps with 12hr format.

I need to convert those timestamps into a 24 hr format, wich is my standard timeformat in the document.

 

But this does not work when writing in scipt:

Timestamp(Timestamp#(MyTimeStampFieldin12HrsFormat,'hh:mm:ss TT') ,'hh:mm:ss') as MyTimeStampFieldin24HrsFormat

Why?

Best Regards

Robert

1 Solution

Accepted Solutions
daveamz01
Not applicable

Re: Convert a timestamp from 12 hr to 24 hr in script

Hello Robert,

     Time format for 12 horus is 'h:mm:ss' and you need the 'hh:mm:ss' format, so drop one h from Timestamp# function:

Timestamp(Timestamp#(MyTimeStampFieldin12HrsFormat,'h:mm:ss TT') ,'hh:mm:ss') as MyTimeStampFieldin24HrsFormat

Best regards,

David


2 Replies
daveamz01
Not applicable

Re: Convert a timestamp from 12 hr to 24 hr in script

Hello Robert,

     Time format for 12 horus is 'h:mm:ss' and you need the 'hh:mm:ss' format, so drop one h from Timestamp# function:

Timestamp(Timestamp#(MyTimeStampFieldin12HrsFormat,'h:mm:ss TT') ,'hh:mm:ss') as MyTimeStampFieldin24HrsFormat

Best regards,

David


rsvebeck
Not applicable

Re: Convert a timestamp from 12 hr to 24 hr in script

Yup. :-)

Thanks David,