Why are events created with timezone-less dates showing the wrong time on facebook.com? - facebook

For example, take this event:
210489449014070 Facebook Event / Graph API Explorer
This event was created back in September 2011. When it was created, it correctly showed Friday, November 11, 2011 11:11pm as the date and time of the event.
But now, it shows Saturday, November 12, 2011 12:11am as the date. This is also happening for future events, such as 426044564103401.
However, it's not happening for even e.g. in the current month like 330237680381087.
Which show the correct date (same as graph shows.) This one was created a few months ago.
My suspicion is that it's still applying the DST offset to the date. For example, right now, pacific time is 7 hours from UTC (because DST is in effect, thus PDT.) On 2012-11-04, DST will end and it will go back to 8 hours from UTC. It "falls back" in fall.
The date on the frontend of Facebook.com is showing as if it's still using the 7 hour offset (it's an hour ahead of what it should be.) My assumption/guess is that at 2012-11-04 02:00:00, it will begin showing the correct date. Hurray? But at that point, the dates that are correct now will probably show wrong (because it won't apply DST anymore.)
I'm guessing this means that internally, timezone-less events are now treated as "-07:00" or "-08:00" globally, based on the current UTC offset, rather than a date-relative one.
Do I have to pull all 186,272 events and update all of them to use timezone dates to fix this (also impacting frontend display to other users, and possibly impacting other parties that are interfacing with these events via FQL or etc.)?
Thanks for any help.

Was probably an issue when Facebook as migrating towards timezone-less events http://developers.facebook.com/roadmap/completed-changes/

Related

Here-Api 7 day forecast changes days mid-day

I'm testing some API calls and was delighted to see that the seven-day forecast was including the current day. Around mid-day my time, the seven-day forecast changed and started returning tomorrow as the first day instead.
https://developer.here.com/documentation/weather/topics/example-seven-day-weather-forecast.html
My theory is that the servers are in California (or similar timezone). I'm in Stockholm. It was probably still "yesterday" in the server's timezone when I started playing with the APIs.
Any suggestions on how to fix this? Ideally, I'd like to see an additional parameter allowing me to specify my timezone, or (even better) automatic timezone detection of the requester.
The requester's timezone is not used in the retrieval of the weather data. The reference time(zone) is the local time of the location of which weather data is requested. For the seven days weather forecast, the next day is chosen as the start day if the local time is after 15:00.
Using forecast_hourly as product parameter will give you hourly weather data starting from the current local day and not the next day.

Backdating posts with Facebook Graph API

When backdating posts, and supplying the backdated_time parameter as UTC in ISO format, the API does pick up the parameter and creates a post, but date-time of the post is significantly off from the original UTC time stamp provided.
For example:
For a post backdated as 2013-12-18T00:53+0000 Facebook generated post that is 19hours off resulting UTC timestamp would be 2013-12-17T05:53+0000
To make it more clear:
Local time (UTC+11): 2013-12-18T11:53+1100
Posted to FB (UTC+00): 2013-12-18T00:53+0000
Resulting in FB post : 2013-12-17T16:53+1100
(assuming FB converts to my local time zone, as it does to the rest
of the posts)
Any help on workaround would be appreciated!
It's a bug in the Facebook Graph API. Facebook seem to be doing a timezone conversion on a time that doesn’t have (can’t have) a timezone. It seems to be relative to US Pacific local time (currently standard time = UTC - 0800).
I'm in US CST (UTC-0600), so the time I submit is always two hours off. As you’re in Sydney, you're on summer time and 19 hours away from Pacific Standard Time (UTC-0800). Beware that when the US Pacific Time Zone switches to summer time in March the offset will change. It will change again when you return back to standard time in April. (I don't have that problem, because I change standard/daylight in sync with PT.) Also beware that Facebook is liable to fix it in the meantime. (If they’re smart, they’ll change the name of the backdated_time parameter and continue to support it for those of us who are working around the bug.)
Put more succinctly: The offset difference is the number of seconds between the local time set on your account and US Pacific Time zone local time, adjusting each for standard and summer time shifts.
You can confirm this by looking at the HTML in the page. At the time stamp, you'll see some HTML that shows their epoch timestamp, which is different from the epoch time you submitted. In my case, I submitted a value of “1391749200”, while the HTML shows a value two hours earlier, “1391742000”:
<abbr title="Thursday, February 6, 2014 at 9:00pm" data-utime="1391742000" class="timestamp livetimestamp">
I don’t see this problem, however, when setting the scheduled_publish_time (future) value.
Use a page token to post. With page token I get correct timing in UTC, the post is displayed adjusted to my timezone (UTC-6, US Central) Tom

Creating a Facebook event whose date is after Daylight Savings Time ends: What UTC offset should be used?

Question: If I add an event using the Facebook API today (offset UTC-4 at my location) for an event that occurs in December (offset UTC-5 at my location), will it appear correctly? Or do I have to submit it as UTC-5 in order for it to appear correctly in December, but (possibly) incorrectly now?
Further Details:
On August 1, 2012, Facebook announced that timezone support would be added to events, including through the developer API. In this blog post, they explain how the changes affect reading and writing events.
For the writing of events, you are now required to include the UTC offset when defining the start_time and end_time. So, if I was in Washington, DC (Eastern Timezone and currently on Eastern Daylight Time) and created an event for today, I would input UTC-4. However, if I am creating an event today, and the event date is December 1 (after Daylight Savings Time ends), would I input UTC-4 (the current offset) or UTC-5 (the relevant offset on December 1)?
I realize that there are a lot of questions about Facebook and timezones, but the ones I have found were written before Facebook announced the new timezone support, and so they don't appear to be relevant to this scenario.
From what I have seen, you should be entering the event with the correct UTC offset for the event time you are setting.
For instance, if you had an event in New York City that began at 7pm on 11/3/12 and ended at 7am on 11/4/12 (DST ends at 2am on 11/4/12 in the USA), you would set the start time as 2012-11-03T19:00:00-04:00 and the end time as 2012-11-04-T07:00:00-05:00.
Facebook should display the times corrected for DST.

passing timezone from client (GWT) to server (Joda Time)

I'm using GWT on the client (browser) and Joda Time on the server. I'd like to perform some DB lookups bounded by the day (i.e. 00:00:00 until 23:59:59) that a request comes in, with the time boundaries based on the user's (i.e. browser) timezone.
So I have the GWT code do a new java.util.Date() to get the time of the request, and send that to the server. Then I use Joda Time like so:
new DateTime(clientDate).toDateMidnight().toDateTime()
The trouble of course is that toDateMidnight(), in the absence of a specified TimeZone, will use the system's (i.e. the server's) TimeZone. I've been trying to find a simple way to pass the TimeZone from the browser to the server without much luck. In GWT I can get the GMT offset with:
DateTimeFormat.getFormat("Z").fmt(new Date())
which results in something like "-0400". But Joda Time's DateTimeZone.forID() wants strings formatted like "America/New_York", or an integer argument of hours and minutes. Of course I can parse "-0400" into -4 hours and 0 minutes, but I'm wondering if there is not a more straightforward way of doing this.
You could use java.util.Date's getTimezoneOffset() method. It's deprecated, but that's pretty usual for Date handling in GWT currently.
And AFAIR, you can specify something similar to "UTC+4" in Joda time.
Update: I looked it up, and it's "+04:00". Or use DateTimeZone.forOffsetHours() or even forOffsetMillis().
Gwittir (http://www.gwtsite.com) is a library for GWT that includes many cool utilities, like databinding, animation, reflection, and more. However, there are some other interesting goodies as well like the new Joda Time integration. If you have ever been frustrated by GWT’s lack of java.util.Calendar support, you’ll love this, as it makes it easy to do date manipulations in your applications.
otherwise, there are other ways to get timezone offset with + & -.
import java.util.TimeZone;
use: TimeZone.getDefault().getRawOffset()
this function will return the offset time in millisecond about your phone seeting. For Example, GMT-04:00 is equals to (-4)*60*60*1000 = -14400000.
After some operations to get the number which you want.
I have a similar but slightly different problem I think.
I actually need to store the clients timezone on the server, so that I can send out messages about dates stored in their calendar.
The dates are stored in UTC time in google app engine and of course I can store the current Timezone offset when creating the appointment. The problem comes when for instance I want to send out a summary email with a list of upcoming appointments in it. These appointments need to be offset with the correct Timezone adjustments for the client (Im happy to assume that they are still in the same timezone as when they created the appointment).
The real problem comes with Daylight Savings adjustments, so for instance I might have appointments stored for Saturday 30th October 2010 at 1pm (BST[GMT+60]) and Monday 1st November 2010 at 1pm (GMT).
So as you can imagine, I cant just use the current timezone offset (BST) as that would mean that the appointment on Monday 1st November would be listed as 2pm rather than 1pm (GMT+60)
It occurs to me that the best way to deal with this is just to store the timezone offset with each appointment individually, but I feel it would be much better to be able to determine the original timezone correctly in the first place, then just let java do the correct adjustments.

How do I handle date and time in different time zone?

I'm developing an international software that act as a simple project management software and I'm facing a problem. This problem is about date/hour and time zone.
When a message is sent from one time zone to another time zone I can store the UTC (GMT) time in my database and then have it displayed differently according to the user's time zone. But this can't be done when I only work with date.
If I say a task is due to the 21st of March. Should I consider that this date can be 20 or 22 in some other countries ? What are your advices on this problem ?
Let's say a user in New York sets a due date for a project as "anytime on Monday 26 January". That means "anytime from 0600 Monday 26 January to 0600 Tuesday 27 January" in Brussels and "anytime from 2000 Sunday 25 January to 2000 Monday 26 January" in L.A.
So completing the task at 2100 on Monday 26 is fine in Brussels and N.Y., but too late in L.A.
One possible work around is never just work with the date. If the time is not specified, either set it for 0000 hrs or 2400 hrs on the date specified in the timezone of the user.
The users may have to deal with strange due dates/times, but speaking as someone who used to work internationally, it kinda goes with the territory.
You won't be able to achieve what you are trying to do without storing the exact time. You simply don't have enough information.
When you don't have a time, assume that the time is the end of business in the main locale for the application, then translate that time as you would any other time. An alternative would be assuming end of the business day in local time and adjust that to UTC. Everyone using the application would need to understand whatever default time assumption you make when the time is not specified. Coordinating to the main office may be best in a large enterprise whereas coordinating to local time may be best in highly decentralized environments where the local context is equally important.
If you aren't storing the minutes and seconds you have to assume that the date being entered is the desired date and not to any adjustments for GMT. Just put it in the database as is. The people on the west coast will have to assume that the due date is the same regardless of where you are in the world. If you want to adjust for time zones, you'll have to collect more information, like hour, minutes, and seconds.
The easiest solution would be just to display as the same date for everyone. The deadline would then effectively be midnight in the latest timezone.
Otherwise, decide what the default time of the deadline should be in the timezone the task was created in, e.g. 21st March 17:00 EST or 22nd March 00:00 EST and display that in the local timezone. The timezone difference will then push it into the previous day or next day accordingly for the viewer.
SQL 2008 allows for a Date datatype that does not have any time value associated with it. That allows someone to say I need this done by this Date, but I don't care if it is +/- several hours. If the date selected is 1/1/2009 but it happens on 1/2/2009 at 2AM their time, they probably don't care.
When the user needs something done by a specific date and time, like close of business on 1/1/2009 then you need to store it in a DateTime as UTC and convert it to local time client-side.
This will take much of the complexity out of indicating when something is completed, it'll either be completed near a specific day or by a specific time.
If you have a single instance of a DB, I would store all dates in the datetime timestamp of your DB server. If you are timestamping rows, consider GetDate() in T-SQL or as default value of the timestamped date column. Then you have your single reference point for all times. Consider UTC format there.
Then, all clients accessing the date do their own conversion into "local time" , which can be interpreted by things like : user preferences, date time stamp on client computer, etc.
Without knowing more, it hard to say exactly what the resolution is.
Your solution depends on your application and requirements.
I'd first store UTC + offset in your data structures, so it's easy to display for any timezone.
Most likely if a task or meeting is due at 12pm on 21/March in London then it will occur at 2130 on 21/March in Adelaide (+0930), but that is an application requirement not any sinister timezone related standard.
If you want the ultimate in flexibility, add a flag that can make the even due simultaneously in every timezone or at the same time no matter where you are (staggered) and show the event accordingly.
You might want to store the date in a from that is timezone aware. This will help you in your calculations. SQL Server 2008 for instance supports a datetimeoffset that does precisely this. Alternatively if you're using SQL 2005 with a bit of effort you can write your own SQL CLR data type to support this.