Home > Forum > Rules, JS, SQL > Format DATE

Format DATE
0

Hello everyone,

I'm wondering if there is any function that will format today's date from original format into "JAN.14.2024" format. Basically to transform the month into letters and display them like that.

Thank youu.

MVP

HI


DECLARE @TodayDate AS DATE = GETDATE();

SELECT
UPPER(FORMAT(@TodayDate, 'MMM')) + '.' +
FORMAT(@TodayDate, 'dd') + '.' +
FORMAT(@TodayDate, 'yyyy') AS FormattedDate;


--Another format
DECLARE @TodayDate AS DATE = GETDATE();
SELECT
CONCAT(
FORMAT(@TodayDate, 'dd'), ' ',
UPPER(FORMAT(@TodayDate, 'MMMM')), ' ',
FORMAT(@TodayDate, 'yyyy')
) AS FormattedDate;


--Polish wersion
DECLARE @TodayDate AS DATE = GETDATE();

SET LANGUAGE Polish;

SELECT
CONCAT(
FORMAT(@TodayDate, 'dd'), ' ',
UPPER(FORMAT(@TodayDate, 'MMMM', 'pl-PL')), ' ',
FORMAT(@TodayDate, 'yyyy')
) AS FormattedDate;

Regards

Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.