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: 
SilviyaK
Contributor III
Contributor III

Date Format

Hi all,

I have a text field that I need to format as a date, but it looks like this:

1-15 March 2023

1-5 April 2024

etc...

How can I format it to a date field so it can also take into account the dates in between the given range? For example for the first one it is all days between 1st of March and 15th of March. 

Thanks!

Labels (1)
1 Solution

Accepted Solutions
Sivapriya_d
Creator
Creator

 

Hi,

Hope this helps.

Temp:
Load
PurgeChar(Date,'- ') as Date_ref,
Date#(SubField(Date,'-',1)&mid(Date,Index(Date,' ')),'DD MMMM YYYY') as StartDate,
Date#(SubField(Date,'-',2),'DD MMMM YYYY') as EndDate;
Load * Inline [
Date
1-15 March 2023
1-5 April 2024
];

DateTable:
Load
Date_ref,
Date(StartDate + IterNo()-1) as Date
Resident Temp While StartDate + IterNo()-1 <= EndDate;

View solution in original post

3 Replies
maheshkuttappa
Creator II
Creator II

Try this code.

tDate:
Load * Inline [
Date
1-15 March 2023
1-5 April 2024
];

Date:
Load
Date as DateID,
Date(Date#(left(Date,Index(Date,'-',-1)-1)& Mid(Date, Index(Date,' ')),'DD MMMM YYYY'),'DD-MM-YYYY')as StartDate,
Date(Date#(Right(Date, len(Date)-Index(Date,'-',-1)),'DD MMMM YYYY'),'DD-MM-YYYY') as EndDate

Resident tDate;

Drop Table tDate;

ContinuesDate:
Load
DateID,
Date(StartDate + IterNo()-1,'DD-MM-YYYY') as Date

Resident Date While StartDate + IterNo()-1 <= EndDate;

 

Sivapriya_d
Creator
Creator

 

Hi,

Hope this helps.

Temp:
Load
PurgeChar(Date,'- ') as Date_ref,
Date#(SubField(Date,'-',1)&mid(Date,Index(Date,' ')),'DD MMMM YYYY') as StartDate,
Date#(SubField(Date,'-',2),'DD MMMM YYYY') as EndDate;
Load * Inline [
Date
1-15 March 2023
1-5 April 2024
];

DateTable:
Load
Date_ref,
Date(StartDate + IterNo()-1) as Date
Resident Temp While StartDate + IterNo()-1 <= EndDate;

SilviyaK
Contributor III
Contributor III
Author

Thanks! This worked perfectly with my data!