Show month as text

Bone_12 361 Reputation points


I have a date time field (date_in) 2021-09-15 11:12:58.2220000 and I would like to pull out the month only. I have created a column month(date_in) as date_in_month but the output is 1-12.

Any idea how I can see this as Jan - Dec please instead?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,599 questions
No comments
{count} votes

Accepted answer
  1. Viorel 83,256 Reputation points

    Check an example that uses FORMAT:

    declare @date_in as datetime = '2021-09-15 11:12:58.222'
    select @date_in, format(@date_in, 'MMM')
    No comments

0 additional answers

Sort by: Most helpful