Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello,
is it possible to change from text to date format?
i have tried somthing like this but without success:
let MyDate = Date('21-Nov-2011');
any suggestion ?
thank you all .
avi
Hi,
take a search into QlikView Help guide for date keyword; maybe MakeDate function is the one that you are looking for.
regards
Hi
as I see your original date format is day-month-year
you can use the MakeDate function as follows:
MakeDate(right(yourDateString,4), mid(yourDateString,4,3), left(yourDateString,2))
hope this solves your problem
hi,
set vstartdate=21-nov-2011
set Date=date(date#(vstartdate,'MMM/DD/YYYY'),'DD/MM/YYYY');
thank you all for the fast answer,
it seems that the sulotion is not working,
i get null instead of date.
avi
Not sure what you are trying to do here. Something like below should return you 21-Nov-2011 as you wanted.
let vTest=date(makedate(2011,11,21),'DD-MMM-YYYY');
Here is a solution that I believe will work for you.
First create an inline table called MonthName:
MonthName:
MAPPING LOAD * INLINE [
MonthAbbr, MonthNum
Jan, 1
Feb, 2
Mar, 3
Apr, 4
May, 5
Jun, 6
Jul, 7
Aug, 8
Sep, 9
Oct, 10
Nov, 11
Dec, 12
];
After that is in place, use the following script:
Date AS OrgDate,
MAKEDATE(Right(Date,4) , ApplyMap('MonthName', TextBetween(Date,'-','-')) , LEFT(Date,2)) AS Date,
You can also use the same script to retrieve year, month, quarter by using those functions before the MAKEDATE code.
Hope this helps!
Try this
let MyDate = Date(Date#('21-Nov-2011', 'DD-MMM-YYYY'));