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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
KKumar92
Contributor III
Contributor III

Date Format Conversion

I have created a variable in the load script as Follow;

Let vForecastDate = $(vMaxDate)+ 5;

My vMaxDate = Oct-2020, and the expected answer is Nov-2020, Dec-2020, Jan-2021, Feb-2021. But I am getting the answer as 44106, 44107,44018.

I tried several options to convert the above variable into MonthName, but it does not work,

Please advise on the above.

 

Labels (1)
1 Solution

Accepted Solutions
rwunderlich
MVP
MVP

Dates are stored internally as number of Days. So "+5" advances the date by 5 days, not 5 months.  You can see the formatted date value by wrapping a Date() function around your expression:

Date($(vMaxDate)+ 5)

What you want is the AddMonths() function:

AddMonths($(vMaxDate), 5)

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTi...

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

2 Replies
rwunderlich
MVP
MVP

Dates are stored internally as number of Days. So "+5" advances the date by 5 days, not 5 months.  You can see the formatted date value by wrapping a Date() function around your expression:

Date($(vMaxDate)+ 5)

What you want is the AddMonths() function:

AddMonths($(vMaxDate), 5)

https://help.qlik.com/en-US/sense/September2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTi...

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

KKumar92
Contributor III
Contributor III
Author

Hi Rob,

Thanks for the solution, it is working perfectly.

Thanks Again.