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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
FelipeDenani
Contributor II
Contributor II

Convert string to date

Hi, can you help me please?

I have the string field "endDate",

That contains values as "01/02/2025".

I need to convert this string to date, how can I do that?

Labels (2)
6 Replies
henrikalmen
Specialist II
Specialist II

Date(Date#(endDate, 'MM/DD/YYYY'), 'MM/DD/YYYY')

FelipeDenani
Contributor II
Contributor II
Author

I think not worked, 

FelipeDenani_0-1741713412046.png

I need something like this:

FelipeDenani_1-1741713433357.png

 

marksouzacosta

Hi @FelipeDenani,

Are you from Brasil?

Try the code below in your Load Script. I'm assuming your code is in the MM/DD/YYYY format:

MyRecords:
LOAD
endDate,
Date(MonthStart(endDate),'YYYY-MMM') AS endDateFormatted
;
Load
Date#(endDate,'MM/DD/YYYY') AS endDate
Inline [
endDate
01/02/2025
02/08/2025
03/12/2025
04/22/2025
];

This is the result:

marksouzacosta_0-1741722735347.png

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

FelipeDenani
Contributor II
Contributor II
Author

Hi Mark, yes I'm from Brazil.

Not worked, I'm using Qlik in Sailpoint interface.

FelipeDenani_0-1741723000919.png

 

marksouzacosta

Legal, também sou! Vou responder o tópico em inglês pra não ficar muito estranho rs.

// ***************

Ok so, you have at least two options:
a) Create a Calculated Dimension - like you are doing
b) Add an extra field or change in your Load Script the existing endDate field (recommended)

Option A:  Calculated Dimension

Use this expression instead of the one that I sent to you:

=Date(MonthStart(Date#(endDate,'MM/DD/YYYY')),'YYYY-MMM')

Option B:  Change the Load Script (recommended)
It is recommended to avoid Calculated Dimensions for multiple reasons. So, when possible, is recommended to change your application Load Script.
Use my code as reference to modify your Load Script - my code is not the final solution, but a reference. You can add a new field - like in my example where I have added endDateFormatted field - or you can  change the expression that calculates your endDate field.

marksouzacosta_0-1741724604126.png

 

Please let me know if that helps.

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

FelipeDenani
Contributor II
Contributor II
Author

Opa aí sim, muito prazer!

Obrigado, vou tentar aqui. Amanhã retorno com updates.

Thank you!