How to convert .NET DateTimeOffset ito Sql2008 DateTimeOffset

I am not sure how to properly format a .NET variable DateTimeOffsetas a string for SqlServer 2008 to fix the parsing of a value.

Currently, if I provide a default value .ToString()from a regular DateTimeOffset value, these are errors.

Here is an example .ToString()that indicates errors (for example, Sql2008 does not like it):'25/12/2008 2:12:21 PM +00:00'

any suggestions? greetings :)

Update

To clarify, I know that .ToString()it is not in a compatible Sql2008 format. I hope someone can tell me that I need to provide an argument IFormattableProvider(for the method .ToString()) that is legal for the new DateTimeOffsetSqlDataType.

Answer

I answered myself. I realized that the correct IFormattableProvider args

myDateTimeOffest.ToString("yyyy-MM-dd HH:mm:ss.ffffff zzz")

!

+5
2
0

BOL .

? , Type System Version 2008 ?

0

All Articles