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