Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Please can someone advise how I can convert a date from format mm-dd-yyyy to MMM-YY?
Thanks,
Daniel
you can try with Upper function like (using stalwar1 expression)
Upper(Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY')) as MonthYear
May be like this:
Date(MonthStart(DateField), 'MMM-YY') as MonthYear
or
Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY') as MonthYear
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')
Thanks Sunny,
Is it possible to change to capitals ie JAN-17 rather than Jan-17?
Thanks,
Daniel
Change this variable into your script as you want
SET MonthNames='jan;fev;mar;abr;mai;jun;jul;ago;set;out;nov;dez';
you can try with Upper function like (using stalwar1 expression)
Upper(Date(MonthStart(Date#(DateField, 'MM-DD-YYYY')), 'MMM-YY')) as MonthYear