tags:

views:

24

answers:

1

hai friends,

i am fresher to asp.net and oracle. in my project, i am storing a datetime in oracle 10g database and i have to retrieve it as a datatable with all other fields in that table. so when i am retrieving it, i am not getting the same date and time. i am using german culture in database and server side. and i am using US culture in client side. when i store the date for eg., 7/10/1986 13:13:13 then when i retriev it at the same time i am getting an different time. here i am getting a time difference of 3 hours. how i will solve this problem???

please help me and god bless you all....

advance thanks....

shafique

A: 

If you're just using DateTime and creating a new DateTime without specifying whether it's local or UTC, that's probably the problem. I would suggest that you store everything in UTC - either explicitly create the DateTime in UTC, or explicitly create it as "local" and then convert it to UTC.

You haven't really specified where the data is coming from, but you should consider what time zone it's meant to be representing. If you're using .NET 3.5 you may well want to think about using DateTimeOffset if possible - and use TimeZoneInfo if you want a time zone other than the one the machine is running in.

Jon Skeet