i have date as follows
2014-01-04 00:00:00.000 (yyyy-dd-mm)
from the above format, i want output as follows
2014-04-01 (yyyy-mm-dd)
for that how can i do using sql server.
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
Espen Skeie4 reputationPosted Nov 14, 2014, 12:26 AM EST
How about this code:
SELECT replace(convert(varchar, getdate(), 111), '/', '-')Kind regards
Espen
Joginder BangerRank #360 · 7K reputationPosted Nov 14, 2014, 12:14 AM EST
declare @dates table (parsed date)
SET DATEFORMAT ymd;
insert into @dates
select GETDATE()
select * from @dates
output
parsed
2014-11-14
Nirmal KumarCRank #6,413 · 267 reputationPosted Nov 14, 2014, 1:10 AM EST
ProcessDate(yyyy/dd/mm)this format Below Data
Thanks