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.
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.
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
Hi,
You can use the function "format()'
SELECT FORMAT(GETDATE(), 'MMM.dd.yyyy').toUpperCase() AS FormattedDate;
Thanks,
Raluca