Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Convert Date format to Month

Hi,

I have a format like 17/12/2012 19:35:38 hours, i want only Month in bar chart.

11.PNG.png

10 Replies
Anonymous
Not applicable
Author

You could use the MonthName() function in a Calculated Dimension in Bar Chart.

If possible though it would be better to create a MonthName field in your load script.

amit_saini
Master III
Master III

Vamsi,

Try this :

Monthname(Your_Date_Field) as Month

and call Month as dimension in bar chart.

Thanks,

AS

anbu1984
Master III
Master III

=Month(Timestamp#('17/12/2012 19:35:38','D/M/YYYY hh:mm:ss'))

Not applicable
Author

HI,

If I catch your issue correctly, I believe you can achieve what you seek just by using MONTH( Date ), either as a new field in your script (recommended), or as a Calculated Dimension in your chart.

amit_saini
Master III
Master III

See the attachment.

Thanks,
AS

Not applicable
Author

Use this it will solve your problem

=Month(Date(SubField(Timestamp(DATE_FIELD,'YYYY-MM-DD hh:mm:ss'),' ',1),'DD/MM/YYYY'))

MK_QSL
MVP
MVP

=Month(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss'))

or

=Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'MMM YYYY')

or

=DUAL(Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'MMM YYYY'),Date(MonthStart(Timestamp#('17/12/2012 19:35:38','DD/MM/YYYY hh:mm:ss')),'YYYYMM'))

Not applicable
Author

Thanks a lot for all your help.

MarcoWedel

Hi,

please specify your requirements, because there are two possibilities:

1. you want the same number of bars and just replace the displayed timestamp with a month, i.e. there will be multiple occurences of each month.

2. you want to aggregate by months, i.e. the number of bars will decrease and each month will only occur once.

solutions like

Date(Date, 'MMM')

will not change the underlying numerical value of your date field but simply format the displayed text and thus keep the different bars untouched (case 1).

solutions like

Month(Date)

will change the underlying numerical value to the month number (1-12) and aggregate all dates within this month.

hope this helps

regards

Marco