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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
KirstenKa
Creator II
Creator II

Change dataformat in script

While uploading my datafile I would like to change the dataformat of a value from general to dateformat MDY and other datavalues I would like to change from general to text. I would like to make this change in the upload script. Is this possible?

Labels (1)
1 Solution

Accepted Solutions
RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @KirstenKa 

Date#() is the instruction to say to Qlik whish format is the data coming

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

While Date() is for changing current format to desired one

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

 

so, if your data comes as 01/15/2023 and you want it as 2023/01/15 you should

Date(Date#("Regional Date", 'MM/DD/YYYY'),'YYYY/MM/DD') as FormattedDate

or, if your data comes as 01/15/2023 and you want it as 23115 you should

Date(Date#("Regional Date", 'MM/DD/YYYY'),'YMD') as FormattedDate

 

Hope this helps,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button!

 

 

View solution in original post

5 Replies
Chanty4u
MVP
MVP

Try this

 

    Date#(YourDateField, 'MDY') as FormattedDate,

    

KirstenKa
Creator II
Creator II
Author

Thanks I can check if it works once I have my full script running. My date value (“Regional Date”) is between “” should the code then be like this? “Regional Date”(YourDateField, 'MDY') as FormattedDate

RafaelBarrios
Partner - Specialist
Partner - Specialist

Hi @KirstenKa 

Date#() is the instruction to say to Qlik whish format is the data coming

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

While Date() is for changing current format to desired one

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

 

so, if your data comes as 01/15/2023 and you want it as 2023/01/15 you should

Date(Date#("Regional Date", 'MM/DD/YYYY'),'YYYY/MM/DD') as FormattedDate

or, if your data comes as 01/15/2023 and you want it as 23115 you should

Date(Date#("Regional Date", 'MM/DD/YYYY'),'YMD') as FormattedDate

 

Hope this helps,

help users find answers! Don't forget to mark a solution that worked for you & to smash the like button!

 

 

KirstenKa
Creator II
Creator II
Author

Ok thanks, I will try once I am able to upload the file and will let you know then

KirstenKa
Creator II
Creator II
Author

This worked thanks