Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql server datetime to string

DECLARE @dt DATETIME = '2019-12-31 14:43:35.863';

SELECT 
    CONVERT(VARCHAR(20),@dt,0) s1,
    CONVERT(VARCHAR(20),@dt,100) s2;

=========================================
                 OUTPUT
=========================================
s1                   s2
-------------------- --------------------
Dec 31 2019  2:43PM  Dec 31 2019  2:43PM

(1 row affected)
Source by www.sqlservertutorial.net #
 
PREVIOUS NEXT
Tagged: #sql #server #datetime #string
ADD COMMENT
Topic
Name
8+5 =