Home > Software design >  Is it necessary to set timezone to a local area when using SendGrid API?
Is it necessary to set timezone to a local area when using SendGrid API?

Time:11-22

If use SendGrid's send_at API in Japan:

https://docs.sendgrid.com/for-developers/sending-email/scheduling-parameters#example-of-send_at-email-header

Set an UTC value to it and post the API to schedule when the mail will be sent.

On the SendGrid's dashboard, is it necessary to change the default timezone to Japan(Asia/Tokyo) to ensure the mail send on Japanese time?

But for other countries, if release the application service to another country with different timezone, how to make sure the mail will be sent correctly for people in two countries?

CodePudding user response:

send_at is a Unix timestamp. Unix timestamps are always in terms of UTC. UTC is the same value simultaneously for everyone on the planet - it does not involve time zones. Whatever UTC timestamp you send to SendGrid, that's the exact time the mail will be scheduled to be sent.

If you are deriving that value from a local time, then you will need to take the time zone into account when you convert from local time to UTC. How you do that is very specific to your own application logic and choice of programming language and platform.

  • Related