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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
Creator III
Creator III

Date conversion in script

Hi All,

How to convert date field from '' to 'YYYYMM'

I have use this in qliksense load script but its not working -

Date(Date#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh.mm.ss'),'YYYYMMDD') as CLAIM_DATE_RECORDED_DATE,
Date(Date#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh.mm.ss'),'YYYYMM') as CLAIM_DATE_RECORDED_YRMN

Please kindly assist

Date.PNG

1 Solution

Accepted Solutions
rogerpegler
Creator II
Creator II

Assuming the issue is the time component being visible and the conversion from text to date/time is ok, use floor() to remove the time component eg

Date(Floor(Date#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh.mm.ss')),'YYYYMMDD') as CLAIM_DATE_RECORDED_DATE,

View solution in original post

6 Replies
shiveshsingh
Master
Master

Hi

 

Try this.

 

Timestamp(Timestamp#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh:mm:ss TT'),'YYYYMMDD') as CLAIM_DATE_RECORDED_DATE,
Timestamp(Timestamp#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh:mm:ss TT'),'YYYYMM') as CLAIM_DATE_RECORDED_YRMN

rogerpegler
Creator II
Creator II

Assuming the issue is the time component being visible and the conversion from text to date/time is ok, use floor() to remove the time component eg

Date(Floor(Date#(CLAIM_DATE_RECORDED,'MM/DD/YYYY hh.mm.ss')),'YYYYMMDD') as CLAIM_DATE_RECORDED_DATE,

suvechha_b
Creator III
Creator III
Author

It didn't work

suvechha_b
Creator III
Creator III
Author

didn't work

shiveshsingh
Master
Master

What is your date format? can you send one sample?

suvechha_b
Creator III
Creator III
Author

Sample file