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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jyoti007
Partner - Contributor II
Partner - Contributor II

How to change different date formats to one required format.


Under <Order Date>  field , there are 2 types of date format in one column 
a) one format :  DD - MM - YYYY
b) another format :  MM / DD / YYYY 

How can I change these 2 different formats into required format i.e. DD/ MM / YYYY ? 
Please help me with the script part.

Order DateRegionRepItemUnitsUnit CostTotal
01-06-2019EastJonesPencil951.99189.05
1/23/2019CentralKivellBinder5019.99999.5
02-09-2019CentralJardinePencil364.99179.64
2/26/2019CentralGillPen2719.99539.73
3/15/2019WestSorvinoPencil562.99167.44
04-01-2019EastJonesBinder604.99299.4
4/18/2019CentralAndrewsPencil751.99149.25
05-05-2019CentralJardinePencil904.99449.1
5/22/2019WestThompsonPencil321.9963.68
06-08-2019EastJonesBinder608.99539.4
6/25/2019CentralMorganPencil904.99449.1
07-12-2019EastHowardBinder291.9957.71
7/29/2019EastParentBinder8119.991,619.19
8/15/2019EastJonesPencil354.99174.65
09-01-2019CentralSmithDesk2125250
9/18/2019EastJonesPen Set1615.99255.84
10-05-2019CentralMorganBinder288.99251.72
10/22/2019EastJonesPen648.99575.36
11-08-2019EastParentPen1519.99299.85
11/25/2019CentralKivellPen Set964.99479.04
12-12-2019CentralSmithPencil671.2986.43
12/29/2019EastParentPen Set7415.991,183.26
1/15/2020CentralGillBinder468.99413.54
02-01-2020CentralSmithBinder87151,305.00
2/18/2020EastJonesBinder44.9919.96
03-07-2020WestSorvinoBinder719.99139.93
3/24/2020CentralJardinePen Set504.99249.5
04-10-2020CentralAndrewsPencil661.99131.34
4/27/2020EastHowardPen964.99479.04
5/14/2020CentralGillPencil531.2968.37
Labels (2)
1 Solution

Accepted Solutions
anat
Master
Master

use below conversion in script editor for Order Date:

Date(Floor(Alt(Num(DateField), Num(Date#(DateField, 'DD-MM-YYYY')), Num(Date#(DateField, 'D/M/YYYY')))), 'DD/MM/YYYY') as NewDateField

View solution in original post

6 Replies
anat
Master
Master

use below conversion in script editor for Order Date:

Date(Floor(Alt(Num(DateField), Num(Date#(DateField, 'DD-MM-YYYY')), Num(Date#(DateField, 'D/M/YYYY')))), 'DD/MM/YYYY') as NewDateField

Vikash2024
Creator
Creator

thank you for providing this solution it really help me to solve my date problem.

pravinboniface
Creator III
Creator III

@anat Can you please explain how this works?

Vikash2024
Creator
Creator

I have two date format DD-MM-YYYY and DD/MM/YYYY  in one column above script change only one format like DD-MM-YYYY?

pravinboniface
Creator III
Creator III

@anat Thank you so much!