Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Timestamp Format

Good morning QV addicts,

I am trying to format a TimeStamp in the following way:

YYYY-MM-DDThh:mm:ss (e.g. 1997-07-16T19:20:30)

The issue I am seeing is that the 'T' which signifiies the start of the time component turns the timestamp into text which then means I cannot use MIN, MAX functions on the field. Can anyone advise me on the correct format code to achieve this and retain the field as numeric and not text?

Thanks in advance

Haider

1 Solution

Accepted Solutions
MVP
MVP

Re: Timestamp Format

Yes, 'T' in your timestamp format will be translated to either 'P' or 'A' as part of 'TT' resp. 'PM','AM'.

I think you can create your own format while keeping the numeric representation using dual() function:

[assuming a TimeStamp TS with a valid numeric representation]:

LOAD

     TS,

     dual( Date(TS,'YYYY-MM-DD') &'T' & time(TS,'hh:mm:ss'), num(TS) ) as MyTimeStamp,

     ...

2 Replies
MVP
MVP

Re: Timestamp Format

Yes, 'T' in your timestamp format will be translated to either 'P' or 'A' as part of 'TT' resp. 'PM','AM'.

I think you can create your own format while keeping the numeric representation using dual() function:

[assuming a TimeStamp TS with a valid numeric representation]:

LOAD

     TS,

     dual( Date(TS,'YYYY-MM-DD') &'T' & time(TS,'hh:mm:ss'), num(TS) ) as MyTimeStamp,

     ...

Not applicable

Re: Timestamp Format

Thank you - I'm becoming a little rusty!

Community Browser