Suppose we have to save Norwegian time 9:00
If we are ignoring day light.In database in UTC
we will save 8:00
. In Display we will add +1
for Norway 9:00
. In India we are adding +5:30
means 1:30
– it should be 12:30
, 1 hour difference
If we consider day light then we should add user +2
for Norway Means in database we will save 7:00
And for Norway for +2
it will be 9:00
And for India it will be 12:30
– correct time. But in this case if we want to see old dates which we have added when day light was false with +1
But now if we show old dates by adding +2
hours. Then it will be 1 hour earlier.
MY Problem
What i am doing is getting local time entered by user.
and converting it to UTC by adding offset hour for user timezone.
And while getting i am passing offset hour for user timezone to SQL and in SQL i am converting UTC date to user local time.
and here the issue comes old dates which i have entered with +1 before 31 march.After 31 march as user offset will be +2 because of day light.So old dates shifted by one hour.
Please correct me where i am doing wrong in handling dates. And how can i solve my problem