Jump to content
  • 0

Get month name


Role21
 Share

Question

Hi,
 
I am using this formula to get the month in the specific Date field:
(DatePart(month, [@field:date]))
And the result of this formula is the number of the month but what I want is the month name for the result to display. 
 
Is there a way to do this? 
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi - I would like to add on this post. In case, you would like to get the month using DATEPART() and add leading zero, you may use these formulas:

RIGHT('0' + CAST(DATEPART(month, [@field:DATE]) AS VARCHAR(10)), 2)

or 

RIGHT('0' + CONVERT(VARCHAR(2), DATEPART(MM, [@field:DATE])), 2)


Result:

January = 1 to 01
February = 2 to 02

Since the DATEPART() function returns an integer, leading zero's will always disappear and need to be manually added like so.


Reference:
https://www.w3schools.com/sql/func_sqlserver_datepart.asp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...