Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Extract month from MM/DD/YYYY format

Hi everyone,

I am trying to extract the month from my date format, however I am not doing it correctly. Should I create a timestamp for my dates and extract the month only after?

1 Solution

Accepted Solutions
rubenmarin

I think is for the separator, in the first case you're using '-' instead of '/'

View solution in original post

6 Replies
rubenmarin

Hi Pedro, if that's not your regional date format you call tell QV wich date format is, to extract month you can use:

=Month(Date#(Day, 'MM/DD/YYYY'))

Notice that internally date is a number, looking on your Day list box you can see that values are left aligned, this tells that it is a string, not a number (numbers are right aligned), so for Qlikview Day field is text, not number (=not date).

anbu1984
Master III
Master III

First convert your input to Date using Date#()

Load *,Month(Day) As Mth;

Load Date#(Day,'M/D/YYYY') As Day,Count From Source;

Not applicable
Author

But I am already doing it!

From my script:

" Date#(('$(vFileDate)'),'MM-DD-YYYY') as Day,"

But only I do it for the secound time it works:

" Date#(Day, 'MM/DD/YYYY') as Day234"

In Qlikview Day is a string but Day234 is already a date. Why it only works when I call for the second time the same function?

rubenmarin

I think is for the separator, in the first case you're using '-' instead of '/'

Not applicable
Author

The machine is always right. I dont know why I didnt notice that.


Thanks!

jpapador
Partner - Specialist
Partner - Specialist

Replace Month(Day) in your script with the following:

Month(Num(Date#(Day, 'M/DD/YYYY')))