Articles of timezones

PHP function showing wrong time in WordPress

My local WordPress installation on XAMPP seems to have a wrong time setting. When I do date( ‘Y-m-d H:i:s’ ); I get 2017-02-21 10:46:43 as result. However my PCs time really is 2017-02-21 11:46:43, so my WordPress is one hour behind. Now I already did, what was recommended here and changed date.timezone in the php.ini […]

I get “The PHP Date/Time library is not supported by your web host.” on my CentOS host, what library to I need to install to add support?

I did some quick looking around, but my PHP skills are pretty nascent. I am sure there is just a package that needs installing. Edit to add additional information about the setup: Using: yum info php I get the version of PHP as 5.1.6: Name : php Arch : i386 Version : 5.1.6 More information, […]

Date, Time, and Timezones

I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions: What is the purpose of the timezone setting in the Admin -> Settings section? Assume current time in GMT is 20:00, and Assume I am in EST (so it is 16:00 in EST time), how is the […]

Why time functions show invalid time zone when using 'c' time format?

These are the functions I use in my theme to display the “entry-meta” which includes published and last modified dates (among others) of an article: // Shows Author and Published Date if ( ! function_exists( ‘reddle_posted_on’ ) ) : function reddle_posted_on() { printf( __( ‘<span class=”byline”>Posted by <span class=”author vcard”><a class=”url fn n” href=”%5$s” title=”%6$s” […]

Trigger a cron every 24h GMT -8

I’ like to run a cron every 24 hours at midnight PST ( = GMT -8 ) This is what I have if ( !wp_next_scheduled( ‘cron_hook’ ) ) { //reset on 00:00 PST ( GMT -8 ) == GMT +16 $timeoffset = strtotime(‘midnight’)+((24-8)*HOUR_IN_SECONDS); if($timeoffset < time()) $timeoffset+(24*HOUR_IN_SECONDS); wp_schedule_event($timeoffset, ‘daily’, ‘cron_hook’); } This sets a daily […]

Is it safe to use 'date_default_timezone_set' in plugin file?

I am using a sitemaps plugin which in very complex ways sets the timezone of <lastmod> (i.e. last modified time) for posts to GMT. Temporarily, until the plugin developer fixes it, I need to enforce a custom timezone on the plugin. The simple and straightforward way that I’ve found is to add something like date_default_timezone_set( […]

How to convert DateTime() to display time based on WordPress timezone setting?

I need to use PHP’s DateTime(). It’s currently displaying GMT time instead of the time that’s set for the timezone setting (EST) in the WordPress Admin. How can this be converted to show the the time base $time = new DateTime(); echo $time->format(“Y-m-d h:i:s”); // 2015-08-12 04:35:34 (gmt) // 2015-08-12 12:35:34 (what i want — […]

When does next Cron Job run (time from now)?

I would need to know how much time is left between now and the next time a specifc Cron Job is done. For another answer I built a basic cron inspector plugin which can be found here. Reason I’m asking is that I’m already that wasted from working that I can’t think straight at the […]

User-Specific Timezones? Hack? Plugin?

Is there any way, whether it be a hack, a plugin, etc., to give users their own timezone? I am using a purchased SMS plugin. Users (my clients) login and are able to send out text messages when they choose. The plugin uses the post engine, including the scheduled post dialogue in the ‘Publish’ box, […]

How to get WP to use EST Timezone

In my settings, I have New York defined as the time zone. But when I run plugins using PHP date() functions, I am getting a time zone of UTC as it shows in WP Admin > Settings > General. Edit: Here’s the mu-plugin I use to add the meta tag: <?php /** * Plugin Name: […]