c# - UTC - Working one day behind -
I have an application that records statistics when a user presents their statistics, the information is stored and the date / Time is entered as UTC eg In the UK, if I enter data on 03/08/2010 10:30
my entry will be the date / time 03/08/2010 09:30
As we presently Looking at DST.
If I was saying that Australia, and I recorded my data locally, my record date / time will be 02/08/2010 23:30
as I think That they are about 10 hours ahead.
My application needs to prepare a statistical report at 7:00 p.m. (local time) when it runs: something like this happens:
var CurrentUtc = DateTime.UtcNow.AddDays (-1); UTC date / time up to 24 hours from the current date
This date (time is not taken into account) then the data is used to draw from the database. Now it's working fine for the UK, it's other international countries that are getting me problems more specifically in Australia.
I have this issue 10 hours ahead, so my application is starting around 03/08/2010 22:00
to generate UK time 04 / 08/2010 07:00
A report for Australia time is something like this:
// At this point the date / time will be 03/08/2010 22 : 00 (UTC 03/08/2010 21:00) var currentUtc = DateTime UTC nine Adwords (-1); // Therefore the current UTC is set on 02/08/2010 22:00 (which is understandable for UK but is not for Australian)
If any of the above is in the UK There was a report for that means that they will receive a report on 02/08/2010 on 03/08/2010 which is correct. However, for Australia (as they are 10 hours ahead), they will receive a report on 02/08/2010 on 04/08/2010 which will be 2 days in advance.
What is happening when my application runs on 03/08/2010 at 22:00 hours, it should prepare a report for Australia which for 03/08 / 2010. However, according to the above installation you can see why this is not happening.
Can not I put my finger on this? I am feeling that this is something like ignoring the time and just depends on the UTC date but I am not sure.
Because the user's day can not start and end at midnight UTC time, therefore your date in the database Time must also be included in the field. Otherwise your Australian report will include 24 hours of data. The date range from 02/08/2010 to 04/08/2010 looks only odd if you ignore time. If you include time and check the boundary again, you will see that there is a 24-hour intent when If you change it back to local time to display the report, then it will be fine.
Comments
Post a Comment