Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert Timestamp to Date

Hi All,

I need to convert the timestamp 'Apr  21 2015  3:45:33:000PM' to  the date format '4/21/2015' .

Kindly help me to achieve the same.

Thanks in adavnce for your help.

Regards,

Krishnan G

3 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try: Date(Date#(Left('Apr  21 2015  3:45:33:000PM',12),'MMM  DD YYYY'),'M/D/YYYY')

Note, there are two spaces between the month Apr and the day 21. These two spaces need to be in the date format string of the Date# function too.


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

Date(floor(Date#('Apr  21 2015  3:45:33:000PM', 'MMM  DD YYYY  h:mm:ss:ffftt')), 'M/D/YYYY')

floor to remove the time part

sunny_talwar

Even this might be helpful if there are inconsistent spaces in your timestamp field:

=Date(Date#(Left(PurgeChar('Apr  21 2015  3:45:33:000PM', ' '), 9), 'MMMDDYYYY'))

here you can replace the manual entry with your date timestamp field in the script:

Date(Date#(Left(PurgeChar(TimeStampField, ' '), 9), 'MMMDDYYYY')) as Date