How to display current date in given format.
Display current date as Dec/28/12 in SQL Server.
Thanks,
Purushottam
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nirav DaraniyaRank #593 · 4.1K reputationPosted Dec 28, 2016, 6:21 PM EST
Simple for getting any datetime format you can use FORMAT function in SQL.
Example:
SELECT FORMAT(getdate(),'MMM/dd/MM') AS PerDate.
Output:
Dec/29/12
Daniel JonesRank #5,109 · 311 reputationPosted Dec 28, 2016, 6:21 PM EST
Purushottam Kumar21 reputationPosted Dec 28, 2016, 8:26 PM EST
Nirav DaraniyaRank #593 · 4.1K reputationPosted Dec 28, 2016, 8:37 PM EST
Try this
SELECT FORMAT(convert(datetime,coldate),'MMM/dd/MM') AS PerDate
Mangesh GRank #294 · 8.6K reputationPosted Dec 28, 2016, 10:53 PM EST
Mangesh GRank #294 · 8.6K reputationPosted Dec 28, 2016, 3:59 AM EST
Khaja MoizuddinRank #270 · 9.4K reputationPosted Dec 28, 2016, 6:44 AM EST