Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
andyrebs
Contributor III
Contributor III

Date conversion

Hello,

I have two field, the first [delivery year]

(2015) and the second [month/day delivery] (313) as follow

delivery yearmonth/day delivery
2015313
2015314
2015314
2015316

How can I load in the script a complete date filed with the format 'DD/MM/YYYY'

Thank you

Best regards.

Andrea

1 Solution

Accepted Solutions
Not applicable

Hi Andrea,

please see attached, can use the below to give you this

Date(Date#([delivery year] & If(len([month/day delivery])<4, 0 & [month/day delivery], [month/day delivery]),'YYYYMMDD'),'DD/MM/YYYY') As date

hope that helps

Joe

View solution in original post

8 Replies
amit_saini
Master III
Master III

Hi,

Date(Your_Date_Field,'DD/MM/YYYY') as Date

Thanks,

AS

Not applicable

Try like below,


date(makedate([delivery year],left([month/day delivery],1),right([month/day delivery],2)),'DD/MM/YYYY') as date

senpradip007
Specialist III
Specialist III

Try like

MakeDate([delivery year], left([month/day delivery], 1), right([month/day delivery], 2)) as Date

andyrebs
Contributor III
Contributor III
Author

Thank you All and thank you Harshal,

your expression works properly, but I have seen that the field [month/day delivery] could be also with 4 digits and not only 3,

eg. 03 november as 1103

       03 march       as   303

How can I manage this difference?

Thanks!!

Not applicable

Hi,

you need to create separate fields like below,

if(len([month/day delivery])>3,left([month/day delivery],2),left([month/day delivery],1)) as [Month_month/day delivery]


&


right([month/day delivery],2) as [Day_month/day delivery]


Then create,


New_TBL:

Load

date(makedate(YearField,[Month_month/day delivery],[Day_month/day delivery]),'DD/MM/YYYY') as Date

resident Old_Table;




Not applicable

Hi Andrea,

please see attached, can use the below to give you this

Date(Date#([delivery year] & If(len([month/day delivery])<4, 0 & [month/day delivery], [month/day delivery]),'YYYYMMDD'),'DD/MM/YYYY') As date

hope that helps

Joe

andyrebs
Contributor III
Contributor III
Author

Thank you Joe!

Not applicable

no worries glad to help