Email reminders - correct timezone - date

I want to send email reminders to users and include the date and time in the email itself. How do I make sure that those are displayed in a user's current timezone, especially when the user might have traveled in the time he saved the record in the database?
Is the only way to just display the date in the email and include the timezone next to it?

Twilio SendGrid developer evangelist here.
When you send an email to a user, unless it is in response to a request that includes the user's current time zone, you cannot know for sure what time zone they are in. So, your suggestion to include the time zone in the date and time is a good idea.
One other suggestion is that you could send them an attachment with a calendar invite that includes the time of the event in UTC that can then be read and displayed by their calendar application in their own time zone.

Related

Exchange Online: Changing timezone for meeting hours?

When updating mailbox timezone in Exchange Online with Set-MailboxRegionalConfiguration, the timezone changes correctly but checking the mailbox through the OWA gui reveals that meeting hours have not changed to match, requiring a manual step by the user.
Message reads:
The current zone for your meeting hours is [timezone]
and is asking if the user is going to remain in the new timezone and to change the meeting hours to match.
Is it possible to set the meeting hours via Powershell?
If anyone comes across this, we ended up using the Graph API to amend this

Google Calendar API V3 insert recurring event default timezone

Looks like there is a bit of inconsistency between 2 ways calendar RECURRING events could be created using the TIME ZONE:
'quickAdd' - does not require you to provide a timezone. The Calendar's default (UTC) or the one set by the Calendar owner will be used. Fair enough.
'insert' - the API doc states: "For recurring events this field is required and specifies the time zone in which the recurrence is expanded. For single events this field is optional and indicates a custom time zone for the event start/end."
Why for 'insert'-ing recurring events we cannot use use the time zone the Calendar already have?
The 'quickAdd' api endpoint clearly shows that it is possible!
For example, if you call the quickAdd with the following text (Important meeting at Office at 11am-11:25am every Fri with John) recurring events will be created with the time zone that already set in the Calendar!
Sure thing that I could get the Calendar time zone from the settings (/calendar/v3/users/me/settings/timezone). But this will require one extra call. It will cause more latency and bring more complexity to the code.
Another issue. The quickAdd api call for recurring events creates not only recurring events but also the same event on the day when the call been made! The API doc does not provide any explanation what are the correct values for the text attribute.
Would be great to hear back from Google API team to clarify those things.
Thank you.

What is the right way to keep the information between my bot and Facebook consistent?

From what I read in the Facebook Messenger documentation, there are a couple of callbacks that are triggered. The onReceivedAuthentication() as per documentation is called when a person taps on the "Send to Messenger" plugin. I want to save the person's firstName, lastName, picture and gender in my database. What if the person directly searches for our page and starts chatting with it? In that case, the above callback won't be triggered right? What if the user changes their name or picture on Facebook? How do I keep my database consistent with Facebook's data for each user?
Currently, I am updating the person's details in my database everytime the user greets my bot. I don't think that is a good strategy. Any suggestions are appreciated.
Just decide particular time limit like 1 hour or 24 hours or 1 week or as per your choice and when you store user's data from facebook by its graph API response,store one more field for that particular time of storing it either by timestamp or date and after that whenever you get message from user just compare that messages' timestamp with that field and if that difference is greater than that decided time limit then update users' data.
you can compare user's current message time as you are getting it in form of timestamp with every message
Hope this help you.

facebook ads daily stats change after collection

I'm writing service which is gathering facebook ads statistics on the daily basis.
The problem is that my collected stats mismatch facebook stats for the particular time period in the past.
For example:
my ad account time zone is UTC+2 and today is 2012-12-18
at 2012-12-18T00:00:00 UTC my service did request to ads api - ..../stats/2012-12-17T02:00:00/2012-12-18T02:00:00
to get daily statistics for 2012-12-17. The result was (for particular adgroup, truncated): impressions = 14950, clicks = 78, etc...
at 2012-12-18T10:52:00 i did same request to fb ads api manually ..../stats/2012-12-17T02:00:00/2012-12-18T02:00:00,
expecting api results will match results in my database, but they are not! Api result was (for same adgroup, truncated): impressions = 15754, clicks = 82, etc...
So it looks like fb ads stats changed, after it was collected. My service includes utc time zone offsets, as suggested in api docs,
and i expected 100% match of collected and actual stats, on daily basis.
Does anybody meet same issue?
We've had the same problem in our accounts.
It's a timezone related issue, you should adjust the timezone, mainly with DST.
You can check the potential dates with problems depending the account timezone here: http://www.timeanddate.com/time/dst/2013.html
and adjust the time offset in the request with the new the start_time and end_time.
A better approach is to automate these changes using timezonedb to keep track of these adjustments to be done: http://es.wikipedia.org/wiki/TZ_Database
hope it helps!
regards,
Martin

Convert UTC date to user's timezone in email message

I'm building a site that stores date/time values in UTC on the database.
When I display these values, I use javascript to convert them to the current's user timezone. This is working correctly so far.
Now I want to send some information to users by email (something like a reminder), and this should have the date time as well.
I don't want to print the UTC time in the email, and since I'm sending the email from the server I don't have access to the user's current timezone.
What's the best approach to solve this? should I store the timezone of the user whenever he logs in and use that to convert the date?
Any comments are appreciated.
Yes, you can detect the user's timezone using Javascript, have the Javascript submit that information to the server, and have the server store it as a preference. If the user sometimes changes timezones you could even keep track of which one they are in most frequently and use that one.