Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have a field in a file 20190220080003 where i change the format of it from timestamp to MMM-YY in script.
When i want to display the months, it will show string 42826 instead of the format i want.
0~20190220080003~98853
let DateTimeStamp=Peek('DateTimeStamp', 0, 'LastLine');
let MonthYear=Date(Date#('01/'&mid($(DateTimeStamp),5,2)&'/'&Left($(DateTimeStamp),4)),'MMM-YY');
=[Month Year] = Apr 17
=max([Month Year]) = 42826
Try this?
Date(max([Month Year]),'MMM YY')
Try this?
Date(max([Month Year]),'MMM YY')
these is number format for your date.
you can use date(max(timestamp),'MMM-YY')
Others have pointed out that you will need the date() formatting function because max() returns a number. I'd also suggest that you can get rid of the complex string parsing by reading the timestamp string with the TimeStamp#() function.
let DateTimeStamp=TimeStamp#(Peek('DateTimeStamp', 0, 'LastLine'),'YYYYMMDDhhmmss');
Then you have a proper Qlik timestamp and can use functions like
let MonthYear MonthStart(DateTimeStamp);
-Rob