
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Variables - Convert Date to Numeric Value
Hi - I have the following variable:
vForecastDateStart
=date(today(),'MM/DD/YYYY')
I would like to convert it to a numeric value such as YYYYMMDD
I tried this :
vForecastDateStartNumeric:
num(left(Date($(vForecastDateStart),'MM/DD/YYYY'),4)&left(right(Date($(vForecastDateStart),'MM/DD/YYY'),4),2)&right(Date($(vForecastDateStart),'MM/DD/YYY'),2))
No luck - any thoughts ? thanks - Jerry
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jerry,
I think Date# will do it.
Date(Date#($(vForecastDateStart),'YYYY-MM-DD'),'YYYY/MM/DD')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, with simple quotes for variable value it should work, also you need to change the date format:
num(left(Date('$(vForecastDateStart)','YYYYMMDD'),4)&left(right(Date('$(vForecastDateStart)','YYYYMMDD'),4),2)&right(Date('$(vForecastDateStart)','YYYYMMDD'),2))
Or just:
=Num#(Date('$(vForecastDateStart)','YYYYMMDD'),'0')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
date(Today(),'YYYYMMDD')
or
num#(date(today(),'YYYYMMDD'))
Regards,
Prashant Sangle
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you want to present it as Date with format YYYYMMDD or do you want to store it as the number YYYMMDD?
If date with format then your got the answer from earlier repliers.
If number then you would need to wrap text(), num(text()) or evaluate (text()) around it.
Like this
Num( Text( Date( date#('$(v Forecast DateStart)', 'MM/DD/YYYY'), 'YYYYMMDD')))
Qlik Community MVP

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jerry,
I think Date# will do it.
Date(Date#($(vForecastDateStart),'YYYY-MM-DD'),'YYYY/MM/DD')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can try this:
=Num#(Date('$(vForecastDateStart)','YYYYMMDD'),'0')
Thanks,
Usama

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
perfect ! Thank you !
