Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Aspiring_Developer
Specialist

Converting Date from DD-MMM-YYYY to DD/MM/YYYY

Hello All,

I have date in below format :-

Aspiring_Developer_0-1662623699455.png

I am trying to convert it into below format :-

Aspiring_Developer_1-1662623730751.png

 

I tried this expression in front end = Date(Date#(ISSUECLOSED,'DD-MMM-YYYY'),'DD/MM/YYYY').

It works in front end but I have to create this field in backend and I am using similar script but it is giving me blank like below :-

Aspiring_Developer_2-1662623820881.pngAspiring_Developer_3-1662623842003.png

Can anyone please help me ?

It seems the date is in text format so I tried to convert it into num using below :-

Aspiring_Developer_0-1662624066603.png

But still it is giving us blank value . 

Thanks in advance

Labels (1)
5 Replies
BrunPierre
Partner - Master

Your conversion should work as it does for me

peter_brown_0-1662629230262.png

 

 

LOAD 
Date(Date#(ISSUE_CLOSED,'DD-MMM-YYYY'),'DD/MM/YYYY') as NewDateField
Inline[
ISSUE_CLOSED,
01-APR-2020
01-APR-2021
01-AUG-2021];

 

So perhaps set the below variable in the script

SET DateFormat ='DD/MM/YYYY';

RsQK
Creator II

I tried forcing those dates as text, I am able to convert them via DATE#. But, if all else fails, you could try something like this:

LET v_min_date = FLOOR(ADDYEARS(YEARSTART(TODAY()),-4));
LET v_max_date = FLOOR(TODAY());

temp_date_list:
LOAD
$(v_min_date) + RECNO() -1 AS date
AUTOGENERATE $(v_max_date)-$(v_min_date)+1;

temp_date_list2:
LOAD
DATE(date,'DD.MM.YYYY') AS date_num,
UPPER(DATE(date,'DD-MMM-YYYY')) AS date_text
RESIDENT temp_date_list;

DROP TABLE temp_date_list;

data:
LOAD
TEXT(ISSUE_CLOSED) AS ISSUE_CLOSED
INLINE [
ISSUE_CLOSED
01-APR-2020
01-APR-2021
01-APR-2022
01-AUG-2021
01-AUG-2022
01-DEC-2020
01-DEC-2021
];

LEFT JOIN (data)
LOAD
date_text 	as ISSUE_CLOSED,
date_num	as ISSUE_CLOSED_NEW
RESIDENT temp_date_list2;

DROP TABLE temp_date_list2;

DROP FIELD ISSUE_CLOSED;
RENAME FIELD ISSUE_CLOSED_NEW TO ISSUE_CLOSED;
Aspiring_Developer
Specialist
Author

I am using Qliksense. Could that be a reason ?

 

RsQK
Creator II

I tested using Qlik Sense aswell, so probably not. Might be locale settings...

BrunPierre
Partner - Master

The scripting syntax in QlikView and Qlik Sense is essentially the same.

Did you change the default format of the date? What was the outcome?

peter_brown_0-1662649300560.png