Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
mahitham
Creator II
Creator II

How to extract Month and Monthyear from Date field?

Hi,

Can any one please help me to extract Month and Month year from below Date field. Here some dates are showing left side and some are showing at right side. Due to this Month() is not working. 

mahitham_1-1602592034749.png

Thanks in advance

 

 

2 Replies
Taoufiq_Zarra

@mahitham  you can test :

 Month(MakeDate('20'&right(subfield(Date,'/',3),2),subfield(Date,'/',1),subfield(Date,'/',2))) as NewDateFieldMonth

 

or

 

Month(Date(
    Floor(
        Alt(
         Num(Date), 
         Num(Date#(Date, 'MM/DD/YYYY')),
         Num(Date#(Date, 'MM/DD/YY'))
         )), 'MM/DD/YYYY')) as NewDateFieldMonth
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Chanty4u
MVP
MVP

i have created one blog for multiple date formats. please have a look.

https://community.qlik.com/t5/Qlik-Sense-Documents/Multiple-Dates-Using-Alt/ta-p/1493744

or try this

table1:

date(Date#(Datefield),'MM/dd/yyyy') as ConverttoNumber;

date(alt(Datefield),'MM/dd/yyyy') as Newdate;

https://ezdatamunch.com/use-simple-date-functions-qlikview-qliksense/