Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6599165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:27:18+00:00 2026-05-25T18:27:18+00:00

So I have a code that receives relevant information for a mobile device, such

  • 0

So I have a code that receives relevant information for a mobile device, such as phone number, name, and message, through which it can send an SMS message. Also, there is a function which delays the SMS. So a user can choose to send a message at a later time using a drop-down menu. Furthermore the delay function checks whether the time at which the message is to be sent between 12:00am to 8:00am, and if so then the default of 8:00am is returned so the receiver will get the message at 8:00am at the earliest. However the problem I am facing is that the time delay is in terms of Mountain Daylight Time (Canada/US), which means that people living in the PDT timezone will receive the message at 7:00am (hour too early) while people in EDT receive the message at 10:00am (2 hours too late). So I was wondering if there is some python code that would potentially detect which timezone the receiver is located in so that he/she receives the message on time (if I select 8:00am in Nevada then the receiver in California will receive the message at 8:00am PDT), given the area in which the receiver is located (eg. the code is given that the receiver is located in California).

Any idea on how to approach this problem?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:27:18+00:00Added an answer on May 25, 2026 at 6:27 pm

    Quick and Dirty: You could dodge the problem by getting the user to say after how many hours/minutes the event should occur. Then it doesn’t matter what their local time zone is.

    Better: If you have the ability to get the local time on the phone, as well as the UTC time (either from the phone or from your server), that will tell you the UTC offset of the phone. You can get away with that most of the time. But UTC offset is NOT the same thing as a local time zone. Near a daylight-savings or summer-time boundary, ideas like “the same time tomorrow” break when you assume that the UTC offset is the same as the time zone.

    Best: For supporting political time zone policies correctly, there is no substitute for the Olson database. Using Olson would imply that your app has a configuration item for the user to set their timezone (examples: America/New_York and Etc/UTC). You might choose defaults for this based on the UTC offset of the phone and the mobile number (using lookup tables as detailed in the other answers) and be correct most of the time.

    In Python the pytz module gives you a very clean API for using the Olson database to work with datetime objects.

    EDIT: This function will convert Unix time to a localized datetime object, given a timezone object:

    def localize_epoch_time(epoch_time, timezone=pytz.UTC):
      u"Given an epoch time return an accurate, timezone-aware datetime object"
      t = localtime(epoch_time)
      epochdt = datetime(*(t[:6] + (int((epoch_time - long(epoch_time)) * 1000000), timezone)
      if hasattr(timezone, 'normalize'):  # pytz tzinfo objects have this
        return timezone.normalize(epochdt)
      else: # tzinfo object not from pytz module
        return epochdt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a code on the client side that receives some data through socket.io
I have some Visual C++ code that receives a pointer to a buffer with
I have code that looks like the following, which works fine for displaying the
I have a form on my company's site which takes a name, telephone number,
I have code that references a web service, and I'd like the address of
I have code that looks like: //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
I have code that looks like this: template<class T> class list { public: class
I have code that I want to look like this: List<Type> Os; ... foreach
I have code that uses Win API function RegSaveKeyEx to save registry entries to
I have code that uses jquery.slideup and jquery.slidedown How can i know that div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.