Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql format time

-- date format
declare @dat datetime = getdate();
select FORMAT(@dat, N'yyyy-MM-dd hh:mm tt') -- returns 2022-05-09 09:35 PM 
-- similar to c# .ToString("yyyy-MM-dd hh:mm tt")
 
PREVIOUS NEXT
Tagged: #sql #format #time
ADD COMMENT
Topic
Name
8+5 =