-- 2 ways
SELECT CONVERT(datetime, '2021-01-01');
SELECT CAST('2021-01-01' AS datetime);
SELECT convert(datetime, '09/10/2019', 101);
-- Create test case
DECLARE @myDateTime DATETIME
SET @myDateTime = '2008-05-03'
-- Convert string
SELECT LEFT(CONVERT(VARCHAR, @myDateTime, 120), 10)
SELECT convert(datetime, '09/10/2019', 101);
declare @Existingdate datetime
Set @Existingdate=GETDATE()
Select CONVERT(varchar,@Existingdate,103) as [DD/MM/YYYY]
-- convert 24 hr text to AM/PM text time
CONVERT(VARCHAR(15),FORMAT(CAST('16:00' as datetime), 'hh:mm tt'))
-- returns 04:00 PM