Can any one justify this two NSDate? - ios

Why are these two fireDate different?
The date displayed in the log is wrong.

The date logged to console is correct, considering that there is no time zone offset (i.e., displayed for UTC). The date displayed in the quick look popover is adjusted for India Standard Time (which is offset +5:30 from UTC).

You are from INDIA I guess and india Time zone is +5.30.
but in Log it showing +000 GMT right.
So if you add +5.30 in your Log Time Then You will get correct time which you can see during debugging.

Related

CloudKit receives and stores time correctly, returns UTC Time when queried

I send a local date to my iCloud container, but when I query it, it returns a UTC date, does anyone know how to change this?
The date also seems to be inconsistent on the dashboard. As you can see, in the data list, the time is local. When I click on it and scroll to the time property, it's UTC.
From Date documentation:
A specific point in time, independent of any calendar or time zone.
So when you are querying the Date from iCloud I am pretty sure you are getting a correct one since it is free of any time zone, so it's dependant on the formatter's locale/time zone when it comes to displaying it.
The date you seen on the record list is date formatter for the locale and timezone of your system. The date you see when you open record details is the same point in time but displayed as UTC date.
e.g. I live in Poland and my timezone is UTC+2 so for me the same Date (point in time) is displayed in the dashboard like this:

microsoftgraph events that are all Day show UTC, not the correct time zone

When I request events "https://graph/microsoft.com/v1.0/me/events", the ones that are all day are flagged as such, but show the wrong times.
Right now they show midnight to midnight but in UTC. My calendar is in CST (CDT now). I don't have a problem with it coming back in UTC, but I would expect 5am to 5am UTC now that we are in DST.
Is there someplace else I should be looking for the Timezone other that in the Start and End fields?
"All Day" events are scoped to a given date not a time and are therefore not adjusted for time zones. When you create an all day event in Outlook you are saying it occupies that date (i.e. January 1st = New Years Day) regardless of which time zone you happen to be located in.

NSDate Daylight time saving

I need to know if we can determine that a particular date had Daylighttime saving ON or OFF.
For eg. In Germany , Daylighttime saving was not there from 1950-1979. Can I determine this programmatically in iOS if these days did not have Daylighttime saving?
You can pick a date and test it. The NSDate accounts for daylight savings.
isDaylightSavingTimeForDate: returns YES if daylight savings time was in effect at that moment in time. If you want to check whether it was in effect in a certain country in a certain year, create an NSDate on 1st of July of that year, and an NSDate on 1st of January of that year, and if neither date had daylight savings time on, then the country didn't have it at all.
(You need to check a date in January as well because Australia, New Zealand etc. have daylight savings time in Summer = January).
iOS is quite good with that kind of historical knowledge. Actually, there are quite a few posts from time to time where iOS has some bizarre but correct information about a timezone and people think it's a bug.

Timezone in the future

I'm working on an app that can book services in later dates in many timezones.
My problem is that when i'm getting timezone for one country, i got this timezone for now.
But this week-end we will change our timezone, and Paris (Actually +1) we'll become +2.
How can I get this timezone for a date like tuesday programmatically ?
You can use various methods.
One would be to use
- (NSInteger)secondsFromGMTForDate:(NSDate *)aDate
of NSTimeZone and get the GMT offset for a certain date and a certain timezone.
Or you can use
– daylightSavingTimeOffsetForDate:
to check wether there needs a DST offset to be accounted for.

Datetime and Time Zones - OpenERP 7

I'm keeping the current date in a model using a datetime field in which I am indicating default to take the current date as a value.
_defaults = {
'f_inicio' : lambda *a: datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
}
Assuming that the current date is '07/10/2013 17:24:05 ', in the view is the date '07/10/2013 12:24:05' and rectified in the database and the date is '07/10/2013 17:24:05'; gather that this subtracting five hours. The user can set the time zone 'America/Bogota', Colombia is in the region (GTM - 5:00). But do not understand how to properly show when the user since I get a totally different value that should show. Apparently this taking as 'GTM 0' the GTM Colombia. Taking the approximate date create_date field that should have given me as default is '2013-10-07 22:24:05.384'.
Anyone have any idea what may be happening, really appreciate any help on this issue that is driving me crazy.
This drived me too crazy in the past. This is a real simple issue.
The date stored in the database is UTC (GMT-0) timezone. Assume that the person is set with timezone GMT - 5:00, then while storing the value to the database, the date will be added with 5 hrs (exactly 5, not little more or little less) and thus we get the UTC time to store into the database. Now when displaying the same it will check for the users timezone and it finds that its GMT - 5:00 so the database time will be subtracted with 5 (again exactly 5, not little more or little less) and displayed the user.
This will be great for system which is used in different timezones. So the understanding is the input is taken in the user's timezone stored in UTC(GMT-0) and displayed to user's timezone (even if the user viewing is in the different timezone the time will be accurate to their timezone)
Note: if the user is not set with the timezone the browsers timezone is considered and will be used with the warning icon on the top corner
That's it. Hope this gives u better clarity!!

Resources