Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
aniruddhyadutta
Creator
Creator

Time Stamp conversion to calculate Max

Hi All,

I want to calculate the max of the time stamps I am getting form the db.

can anyone please help me to convert the time stamp so that I can calculate max on it.Max seems not to be working on this format

time stamp.PNG

5 Replies
swuehl
MVP
MVP

Try using Timestamp#() to interpret your values:

=Max(Timestamp#('19-Sep-16 06.55.31.000000385 PM','DD-MMM-YY hh.mm.ss.fff TT'))

returns

42632.788553241

aniruddhyadutta
Creator
Creator
Author

Thanks a lot for your helpful reply Stefan.

Actually I was trying to figure out the max date and have also used that to compare with the latest_update_date

the where clause is like this

FROM Table1 where  (Date(Date#((Left([Datefield],18)),'DD-MMM-YY hh.mm.ss'),'DD-MMM-YY hh.mm.ss'))> $(last_Updated_Date) ;

but the script is not able to compare and throwing error.

the last updated date field snippet is as below

Last_Updated_Date:

Load

    max(Date(Date#((Left([Datefield],18)),'DD-MMM-YY hh.mm.ss'),'DD-MMM-YY hh.mm.ss')) as MaxDate

    Resident  MasterData;

let last_Updated_Date= Peek('MaxDate',0,'Last_Updated_Date');

If I hardcode the date the script is working.Can you help me to figure what I am doing wrong.

sasiparupudi1
Master III
Master III

You can try MaxString

swuehl
MVP
MVP

Maybe your variable replacement needs to be enclosed in single quotes:

... > '$(last_Updated_Date)' ;

Or create a number to compare your input values to:

let last_Updated_Date= Num(Peek('MaxDate',0,'Last_Updated_Date'),'#.#','.',',');

Shubham_Deshmukh
Specialist
Specialist

Hi @swuehl ,

Hope u are doing Great !!

Need some help for same scenario, I have TimeStamp in excel MMM DD YYYY hh:mm:ss:fff TT 

and I want to take max from those dates and show it in the format MM-DD-YYYY hh:mm:ss

Already tried as per your code also but seems I am missing something, please help.

Rgds,

Shubham