Getting DateTimeOffset value form SQL 2008 to C#
Posted
by Darvis Lombardo
on Stack Overflow
See other posts from Stack Overflow
or by Darvis Lombardo
Published on 2010-04-19T16:02:46Z
Indexed on
2010/04/19
16:23 UTC
Read the original article
Hit count: 228
I have a SQL 2008 table with a field called RecDate of type DateTimeOffset.
For a given record the value is '2010-04-01 17:19:23.62 -05:00'
In C# I create a DataTable and fill it with the results of "SELECT RecDate FROM MyTable".
I need to get the milliseconds, but if I do the following the milliseconds are always 0:
DateTimeOffset dto = DateTimeOffset.Parse(dt.Rows[0][0].ToString());
What is the proper way to get the value in the RecDate column into the dto variable?
Thanks!
Darvis
© Stack Overflow or respective owner