Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

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,

     ...

View solution in original post

2 Replies
swuehl
MVP
MVP

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
Author

Thank you - I'm becoming a little rusty!