I get a string as input from an application that is supposed to be a date. For some asinine reason the developers of the application decided provide precision to the microsecond. Well, actually, to the tenth of a microsecond.
The string is in the format: 2014-08-15T17:38:22.2930000
Before they changed this input format I was using the following to convert the date.
select DATEADD(dd, 30, @Date)
I know I could just do a substring on the input and lop off the last 4 characters, however, I'm wondering if there is some way that I can use CONVERT to just convert the date, or if SQL just doesn't support dates with this type of precision.
Either of these should work:
SELECT CONVERT(DATE, '2014-08-15T17:38:22.2930000', 101)
SELECT CONVERT(DATETIME2, '2014-08-15T17:38:22.2930000', 101)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With