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 8922607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:53:05+00:00 2026-06-15T06:53:05+00:00

Working on a mod where a user inputs a datetime in this format 11/28/2012

  • 0

Working on a mod where a user inputs a datetime in this format “11/28/2012 11:34 am”.

I am then using strtotime to convert it to a timestamp and saving it to my database.

I am then displaying it to the user in my template using the following date(DateTime, ‘D M jS g:i A’).

The problem is users who are not in the same timezone as the user who created the event do not get the correct time updated to reflect their timezone.

I have access to both timezone offset’s of the user posting and the user viewing.

MY question is how should I compensate for timezone differences?

  • 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-06-15T06:53:08+00:00Added an answer on June 15, 2026 at 6:53 am

    When converting the string to the real timezone use this to override server time zone with time zone of the user submitting the value: https://www.php.net/manual/en/function.date-default-timezone-set.php

    When retrieving it later, use the same function to override server time zone to current user’s one (the one that is appropriate for the user displaying datetime at the moment).

    Also make sure you store it properly in the database: preferably using Unix timestamps within PHP, TIMESTAMP columns within database, FROM_UNIXTIME() database function when saving to the database and UNIX_TIMESTAMP() when retrieving from database (all are valid for MySql RDBMS, check your own DBMS if it is different).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am having a little difficulty working out this mod rewrite rule /
I'm working with mod_rewrite, and using page titles e.g. About Us that have been
Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with H2 I get this error when I try to write a row
We're working on developing user widgets that our members can embed on their websites
I'm working on a simple shopping cart. When the user clicks checkout the URL
Im tired of trying to put this working :( So, here is my problem:
Background: I'm working a project which uses Django with a Postgres database. We're also
I'm working with MVC3, and using Entity Framework 4.0 Entities as my model. So
i am using codeigniter 2.1.0 and mysql database. in my admin panel i have

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.