Hi folks,
i'm not sure how to correctly format a .NET DateTimeOffset
variable, as a string, for SqlServer 2008 to correct parse the value.
currently, if i provide the default .ToString()
value from a normal DateTimeOffset value, it errors.
Here is a sample .ToString()
value that errors (eg. Sql2008 doesn't like it): '25/12/2008 2:12:21 PM +00:00'
any suggestions? cheers :)
Update
Just to clarify, I know the .ToString()
is not in a compatible Sql2008 format. I'm hoping someone might be able to tell me what i need to provide to an IFormattableProvider
argument (for the .ToString()
method) which is legit for the new DateTimeOffset
SqlDataType.
Answer
I've answered it myself. I figured out the correct IFormattableProvider args
myDateTimeOffest.ToString("yyyy-MM-dd HH:mm:ss.ffffff zzz")
cheers!