Title: Date Bug
Last modified: August 21, 2016

---

# Date Bug

 *  Resolved [xenoalien](https://wordpress.org/support/users/xenoalien/)
 * (@xenoalien)
 * [13 years ago](https://wordpress.org/support/topic/date-bug/)
 * Hi I have a client that lives in UK and the web server is in California. I know
   you have addressed time zones issues however there still is a bug I am experiencing.
   And yes I do have the latest version. (1.1)
 * Basically when you get the date from the wordpress function, which does account
   for time zone settings set in wordpress General Settings, on about line 55 in
   st-daily-tip_backup.php I see it is used to query the database to find the tip
   for that day. However further in the code when you account for the tip being 
   set to display yearly you offset the display_date to next year while grabbing
   the current date based on the web server not wordpress.
 * This means that if my web server is on one side of the world and someone has 
   set their wordpress settings to their time zone and they are on the other side
   of the world (ahead in time zones) there will be approximately 12 hours where
   the tip will not show.
 * To fix this I simply got the wordpress (time and date based) $todate variable
   and replaced the year part of the string with the next year and stored it in 
   $yearlaterdate. Before it updates yesterday’s date with the new date which is
   a year ahead.
 * //CLEAR OUT THE YEAR
    $todate = substr($todate, 4);
 * //GET THE WORDPRESS YEAR
    $wordPressYear = the_time(“Y”);
 * //SET TO NEXT YEAR
    $wordPressYear += 1;
 * //PUT NEXT YEAR ON THE DATE
    $yearlaterdate= $wordPressYear . $todate;
 * $wpdb->query(“UPDATE $table_name SET display_date = ‘$yearlaterdate’ WHERE ID
   = ” . $tips[‘id’]);
 * [http://wordpress.org/extend/plugins/st-daily-tip/](http://wordpress.org/extend/plugins/st-daily-tip/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Dhara Shah](https://wordpress.org/support/users/dharashah/)
 * (@dharashah)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/date-bug/#post-3781271)
 * Hi xenoalien,
 * Yeah! You are right! I missed out there.
    I have made changes in latest version
   1.2 Please do check!
 * Thanks for feedback,
    Dhara Shah

Viewing 1 replies (of 1 total)

The topic ‘Date Bug’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/st-daily-tip_9eb177.svg)
 * [St-Daily-Tip](https://wordpress.org/plugins/st-daily-tip/)
 * [Support Threads](https://wordpress.org/support/plugin/st-daily-tip/)
 * [Active Topics](https://wordpress.org/support/plugin/st-daily-tip/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/st-daily-tip/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/st-daily-tip/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Dhara Shah](https://wordpress.org/support/users/dharashah/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/date-bug/#post-3781271)
 * Status: resolved