String_To_DateTime2
Retrieves a datetime2 value from a string.
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.String_To_DateTime2 ( @String )
Name | Type | Description |
---|---|---|
@String | varchar(MAX) | Any character string, variable, or expression. |
datetime2
This powerful function is able to convert strings to dates in many uncommon formats. However, it is relatively slow so use sparingly.
1 2 3 |
SELECT SQLHTTP.net.String_To_DateTime2('2017-11-21T14:37:03.380 +05') |
1 2 3 4 |
--------------------------------- 2017-11-21 01:37:03.3800000 |