1091
Views
9
Comments
How to convert Month integer to month abbreviation on column chart?
Question

I am trying to convert the data on my table from an integer of the month to an abbreviation. I thought using a formula similar to this solution below posted on another thread would work, but it doesn't like when I substitute CurrDate() with the data from my table. 


FormatDateTime( CurrDate() , "MMMM")


This is the group by table I am using and I have successfully displayed the month on my chart, but I would like that month number to be the abbreviation of the month. 





Any help would be appreciated 

2019-12-06 12-15-54
Rui Sequeira

Hi Brett,


You could convert the date which is an integer to a text, and then the text to a date.

You expression would be something like this:


FormatDateTime(TextToDate("2019-"+"11"+"-1"),"MMM")

Since you only need the month, you can fill the year and day with whatever. And just concatenate the texts to give you a date format but with your integer as a month in it. 

Your data from the table is the "11" on the expression above.


Hope it helps!

2022-09-15 15-26-02
Leonardo Nascimento

Hi,

As Rui Sequeira said.

you can use the built-in functions " FormatDateTime(Data, "MMM") "


ex: 


Regards,

2025-11-19 06-14-01
Miguel Verdasca
Champion

Hi,

You could create a new date with your month and use the date to text conversion with the mmm format (it will give the month name). 

Or you can just write a function that receives an integer and return the name of month as output using a switch or a sequence of IFs. 

Other option, you can use the component Month Conversion.

Cheers,

Nuno Verdasca

UserImage.jpg
Brett Nagle

Nuno Miguel Verdasca wrote:

Hi,

You could create a new date with your month and use the date to text conversion with the mmm format (it will give the month name). 

Or you can just write a function that receives an integer and return the name of month as output using a switch or a sequence of IFs. 

Other option, you can use the component Month Conversion.

Cheers,

Nuno Verdasca

So I actually created my requests by month based on the actual requested date data. When I try to do a date to text conversion I get this. 


2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Brett,


I'm not sure you're still doing what you want to accomplish here, by the looks of it, your aggregate output is no longer grouped by month but by individual timestamps a request was made.  That's probably not your intention ??

just an alternative that I find easy to work with, is to group by month and anything else you might want to group by (status, customer,...) and add the min(date) as an extra calculated column to your aggregate.  



Then you can apply the formatting to that column for your chart.



See attached oml.


good luck with it,

Dorine


ChartDemo.oml
2025-11-19 06-14-01
Miguel Verdasca
Champion

Hi, 

I hope this help you.

I built two examples, one that fetches the abbreviated month from the current date, and another that I construct a date with one month last per variable and then get that abbreviated month.

If this is not what you want, can you give me more detail about what you want?



UserImage.jpg
Brett Nagle

Hey everyone I figured out a solution. I created a new entity attribute to just track the month and then I took the feedback you all applied and got the chart working properly on my dashboard! 

2021-10-26 09-17-56
João Delgado

Hi Brett,


Although you already found a solution, I would like to share that there is also the following possibility:



There is this Date_MonthName server action that will ask you for a date, and in exchange will offer you the month name. 


Best regards,


João Delgado

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

In addition to what's been said above, note that the Platform, when the Label Attribute of a chart's DataPoint Structure contains a Text that's convertible to a Date or DateTime (e.g. the result of a DateTimeToText()), it will instruct Highcharts (the underlying chart engine) to create a date/time axis.

If you just supply a month number, like what the OP did, the Platform nor Highcharts will know this is actually a date, and treat the Label like any other Text. Now if Highcharts knows you're displaying dates, you can instruct it how to format that date. This describes the default, based on the scale of dates displayed. For month data, it will look like this:

If you don't want the year, you need to override the formatting, which you can do with the AdvancedFormat_Init Function, supplying the following JSON:

    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            month: '%b'
        }
    }

Which will result in this:

Tl;dr: if it's about date/time, always use proper date/time values and use Highcharts to format the labels. Don't go formatting prematurely!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.