Note that there are some explanatory texts on larger screens.

plurals
  1. PODateTime countdown and expiration
    primarykey
    data
    text
    <p>I have posts on my site that have an expiration datetime I store these in Mysql in as</p> <pre><code>'Y-m-d H:i:s' </code></pre> <p>ie. 2012-08-28 00:00:00 </p> <p>I convert this datetime to the format below which is passed to a jquery countdown</p> <pre><code>$offset.', Y, n - 1, j, H, i, s' </code></pre> <p>This part works the way it should.</p> <p>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 </p> <pre><code>-4, 2012, 8 - 1, 28, 00, 00, 00 </code></pre> <p>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</p> <pre><code>2012-08-27 20:00:00 </code></pre> <p>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</p> <pre><code>2012-08-28 21:00:00 </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload