Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
dhirajkhodade
Contributor III

Format date time to MM-DD-YYYY hh:mm:ss

Hi 

I am reading data from excel file .

In excel file column value is  - "Aug  7 2019 10:35:11:773PM"

And after reading it inside my qlik sense application I want to format it to - MM-DD-YYYY hh:mm:ss

i.e. 08-07-2019 10:35:11 PM

This is what I am doing

Date#(Date#(Peek('SNAPTIME',0,'DataFromExcel'),'MM-DD-YYYY hh:mm:ss'),'MM-DD-YYYY hh:mm:ss');

but returns result as - Aug  7 2019 10:35:11:773PM  instead of 08-07-2019 10:35:11 PM

 

can someone help me with this?

 

Labels (2)
2 Replies
Shubham_Deshmukh
Specialist

Hi Dhiraj,

Try this,

Date(Date#(Peek('SNAPTIME',0,'DataFromExcel'),'MMM DD YYYY hh:mm:ss'),'MM-DD-YYYY hh:mm:ss');

In date#(), date format has to be existing format and in Date() it has to be required format.

Rgds,

Shubham

 

dhirajkhodade
Contributor III
Author

Hi Shubham thanks a lot for quick reply ..

I tried what you said -

Let ReportRunTimeStamp = Date(Date#(Peek('SNAPTIME',0,'FromAladdin'),'MMM DD YYYY hh:mm:ss'),'MM-DD-YYYY hh:mm:ss');

but it did not work.

I am using variable ReportRunTimeStamp on UI inside expression

i.e. =$(ReportRunTimeStamp)  

also I tried ='$(ReportRunTimeStamp)'

but it is not getting evaluated. It gives empty output on UI