Discussion board where members can get started with QlikView.
Dear Qlikview community members,
How do I change a text monthname (3 leters) to a month number?
So how does Feb become 02?
Go to Solution.
See the attached file.
Hope that helps
If you have 12 month in letters, you can use a simple map table to transform to number :
first load a table like this for 12 month with the name and coresponding number :
LOAD * INLINE [
then use it when loading your data :
ApplyMap('MAP_MONTH',Month) as No_Month,
Yes that was the solution I have now, but there must be a way to let Qlikview recognize the months when using:
In the script. If not I will use this :-)
You can try by setting a variable
=Num(Month('02/02/2012')) returns 2
Thanks Manisha but my date field looks like '2 Feb 2012' and is a text field.
I already used :
KeepChar(datefield, 'JanFebMarAprMayJunJulAugSepOctNovDec') as Month,
So my field Month has now 'Feb' as text. But Qlikview does not recognize it as a month.
=date(date#(MyDateString,'dd MMM yyyy'),'dd-MM-yyyy')
=date(date#(''12 feb 2012,'dd MMM yyyy'),'dd-MM-yyyy') returns a date formatted as 12-02-2012
=date(date#('12 feb 2012','dd MMM yyyy'),'dd-MM-yyyy') Returns: -
See attched file.
Maybe you could try this one.
if the format is this '2 Feb 2012'
you could try this
Date(Date#(mid('2 Feb 2012',3,3),'MMM'),'MM')
Thank you all, I used Mayil's solution.