Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need the name of the month to appear?

Laurie Huth
Contributor
December 12, 2022

I am using the 'Edit Table Transformer' macro. 

In SQL I know I can extract the month using SELECT *, MONTH('Due') AS 'Month',

However, it returns an integer value (i.e. '1' for month of January, '2' for February, etc.)

I want the result to actually list the month name (i.e., January, February, March, etc.)

I've been trying other workaround to no avail. i.e., FORMATDATE etc. I've also tried to do a WHEN-THEN-ELSE case that says if "1" then return 'January', but I could get that to work either.

Note: There are other columns of data that need to be left in the format like mm/dd/yy, so I don't want to change the format in the Settings tab and force a particular format across all the dates.

 

1 answer

2 votes
Katerina Rudkovskaya _Stiltsoft_
Atlassian Partner
December 13, 2022

Hi @Laurie Huth,

Please follow these steps: go to the Table Transformer macro settings and set the required date format that corresponds to the format used in your source table.

Tue 10-1.pngTue 10-2.png
Then use the following SQL query:

SELECT 'Date', 'Month',
CASE
WHEN 'Month' = 1 THEN "January"
WHEN 'Month' = 2 THEN "February"
WHEN 'Month' = 3 THEN "March"
WHEN 'Month' = 4 THEN "April"
WHEN 'Month' = 5 THEN "May"
WHEN 'Month' = 6 THEN "June"
WHEN 'Month' = 7 THEN "July"
WHEN 'Month' = 8 THEN "August"
WHEN 'Month' = 9 THEN "September"
WHEN 'Month' = 10 THEN "October"
WHEN 'Month' = 11 THEN "November"
WHEN 'Month' = 12 THEN "December"
END
AS 'Pretty Month Name'
FROM (
SELECT *,
MONTH('Date') AS 'Month'
FROM T1)

Tue 10-3.png

Hope this helps your case.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events