Search notes:

SQL Server: datatype date

Date literals

cast as datetime

When a string is cast as datetime, the current language is considered. The following cast would not work if the language was set to german, for example.
set language english
select
  cast('2018-08-28' as datetime)

functions

datepart can be used to extract parts of a date, for example
select datepart(hour, sysdatetime());
A date can be converted into a textual ISO 8601 representation with a convoluted convert:
select convert(varchar(23), getdate       (), 126);
--
-- 2019-06-22T18:01:49.820

select convert(varchar(27), sysutcdatetime(), 127);
--
-- 2019-06-22T16:01:49.8205525

date arithmetic

dateadd

See also

The datename() function.
Unambiguous date formats.
data types and date and/or time related data types

Index