Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Date Format

Hi,

Please can someone advise how I can convert a date from format mm-dd-yyyy to MMM-YY?

Thanks,

Daniel

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

you can try with Upper function like (using stalwar1‌ expression)

Upper(Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY')) as MonthYear

View solution in original post

5 Replies
sunny_talwar

May be like this:

Date(MonthStart(DateField), 'MMM-YY') as MonthYear

or

Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY') as MonthYear

Clever_Anjos
Employee
Employee

If your field is a date formatted as mm-dd-yyy you can use

Date(MonthStart(yourfield),'MMM-YY')

If you have a string with mm-dd-yyyy

Date(MonthStart(Date#(yourfield,'MM-DD-YYYY')),'MMM-YY')

danielnevitt
Creator
Creator
Author

Thanks Sunny,

Is it possible to change to capitals ie JAN-17 rather than Jan-17?

Thanks,

Daniel

Clever_Anjos
Employee
Employee

Change this variable into your script as you want

SET MonthNames='jan;fev;mar;abr;mai;jun;jul;ago;set;out;nov;dez';

settu_periasamy
Master III
Master III

you can try with Upper function like (using stalwar1‌ expression)

Upper(Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY')) as MonthYear