Hi all, by using below sql statement i want to get required format
declare @tdy datetime SET @tdy=GETDATE() SELECT @tdy result : 2017-11-18 11:50:27.067
by using above result i want to get below format
18-Nov-2017 11:50
how to achieve this query..
Thanks in advance
Hi nagaraju60,
Try below test query for your reference.
SQL
DECLARE @FormatedDate VARCHAR(20) SET @FormatedDate = STUFF(STUFF(CONVERT(CHAR(20), getdate(), 113),3,1, '-'),7,1,'-') SELECT SUBSTRING(@FormatedDate,0,LEN(@FormatedDate)-2)
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.