Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

change the format of a date

Hi, i have a date field in the format of    DD/MM/YYYY

I am trying to seperate it in the script for day, month, year which i have done by :

Day(Date_Field) as Day,

Month(Date_Field) as Month,

Year(Date_Field) as Year,

But i also want a field for Month-Year but i only want the last 2 digits of the year displayed

so i want..

Jan - 12

Feb - 12

ect.

Can anyone help me?

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do the trick

Date(Date_Field, 'MMM - YY')

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Jonathan,

So this is what i put in the script?

Date(INVOICE_DATE, 'MMM - YY')AS MonthYear,

I now get multiple entries for each one?

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

That's probably because there is a time component in the field. Date() simply formats, but the underlying values differ, leading to what seems like duplicates. Use this instead:

Date(Floor(INVOICE_DATE), 'MMM - YY')AS MonthYear,

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein