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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:46:47+00:00 2026-06-10T08:46:47+00:00

I have posts on my site that have an expiration datetime I store these

  • 0

I have posts on my site that have an expiration datetime I store these in Mysql in as

'Y-m-d H:i:s'

ie. 2012-08-28 00:00:00

I convert this datetime to the format below which is passed to a jquery countdown

$offset.', Y, n - 1, j, H, i, s'

This part works the way it should.

What I am trying to do is get the current time and only get the unexpired posts from the database. The thingM that is tripping me up is that all the post have different timezones. Most of them expire at midnight but in different timezones some expire at midnight eastern while others expire midnight pacific. These are all stored as 2012-08-28 00:00:00 with a timezone stored in the database as timezone.name ie. America/Eastern. For the countdown the $offset is created from this value being -4 so the input to the countdown is

-4, 2012, 8 - 1, 28, 00, 00, 00 

Which work for the jquery counter I am using but it doesnt work when trying to compare current date to the mysql date entry. I have tried setting the timezone before getting the mysql datetime entry and storing a value like this for eastern

2012-08-27 20:00:00 

when I try to set current time and I use my America/Phoenix timezone I get a value that is at 9pm when the eastern post should expire I get

2012-08-28 21:00:00 

which to me means the post would have expired an hour early. This is were I am stuck I am open to storing the data in multiple db entries on for the countdown and one for the expiration db check I just dont know what the best way to achieve what I need is. Any help is appreciated. 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-06-10T08:46:49+00:00Added an answer on June 10, 2026 at 8:46 am

    I personally would convert all expiration times to UTC (or some other defined timezone – maybe that of your DB server and application server if they are the same) before entering them into the database table and then query against that table based on the the timezone of the particular user. So for example the WHERE clause might look like

    WHERE expiration_datetime > NOW() + INTERVAL X HOUR
    

    where X is where you apply the hour difference for user’s timezone.

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

Sidebar

Related Questions

So I have this site that dynamically posts content using jquery and php. I
Does anyone have a favorite style site that posts the latest and greatest sites
I have a team site blog with many posts that I wish to export.
I have a site that features some pages which do not require any post-back
I have an MVC3 site that needs to handle user posts. I am trying
I've imported a bunch of posts into a Wordpress site that all have the
I have a form that posts a file to a site that I don't
I have a link on my site that shows a random post, and the
I have a wordpress site that I only want to allow people to post
I have a posts table for my reddit-clone site and I'm wondering whether I

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.