Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
evansabres
Specialist
Specialist

Convert Month in Script

I have a field called [Event Date Time] which is formatted as MM/DD/YYYY and is numeric so, 11/12/2016

I want to display just the MM (months) in a list box. In the script, how can I pull out just the month and convert it to just display NOV for the above date.

1 Solution

Accepted Solutions
sdmech81
Specialist
Specialist

HI just say,

month( [Event Date Time]) as Event Date Time]

It ll give u month name as NOV

Sachin

View solution in original post

8 Replies
aarkay29
Specialist
Specialist

Date([Event Date Time],'MMM')

evansabres
Specialist
Specialist
Author

When I enter this in my script I get errors and I cannot reload. Am I missing something other than

MONTH([Event Date Time], 'MMM') ??

vishsaggi
Champion III
Champion III

Try this?

Month([Event Date Time]) AS Month

Month takes only one parameter...

Not applicable

Hi Evan,,

Use the below script and use the Month field in the list box

Test:

LOAD

"[Event Date Time]",

month("[Event Date Time]") as Month

FROM

********** source.

MarcoWedel

If your [Event Date Time] field is not a dual value already, then you can try with

Month(Date#([Event Date Time],'MM/DD/YYYY'))

else this expression should be sufficient:

Month([Event Date Time])



hope this helps


regards


Marco

Not applicable

!Hi,

The first thing you have to do is, to say what is the format of the date in date# function.

And you can use the date function to tell how the data should be shown.

While using Month(date()), the output will be your expected format 'Nov'.

You can use the following function.

load

month(date(Date#([Event Date Time],'MM/DD/YYYY'))) as [Event Date Time]

from source_table_name;

Attached qvw for your reference.

Regards,

Vivek

Chanty4u
MVP
MVP

try below script

a:

LOAD * INLINE [

    "Event Date Time"

     11/12/2016

     12/12/2016

     13/11/2016

     14/12/2016

       

];

Result:

LOAD

Month( "Event Date Time") as NewMonth

Resident a;month.PNG

sdmech81
Specialist
Specialist

HI just say,

month( [Event Date Time]) as Event Date Time]

It ll give u month name as NOV

Sachin