[wp-testers] Date() function

Andrew Nacin wp at andrewnacin.com
Mon Apr 19 05:59:31 UTC 2010


WordPress sets UTC time internally then works timezones off of that. Try
current_time( 'timestamp' ) for the unix representation of the date that
WordPress thinks it is.

On Sun, Apr 18, 2010 at 10:59 PM, Chris Klosowski
<chris at chriskdesigns.com>wrote:

> Whenever I try and run the PHP function date("Y-m-d") within my WordPress
> installation it appears to be modifying it by 1 day from the servers
> actually date("Y-m-d").
>
> The readout from a standard PHP file *outside* of WordPress is:
> 2010-4-18
> Which would trigger my plugin if it was within the WordPress environment.
>
> If I echo the date("Y-m-d") function *inside* of a WordPress file, my
> plugin
> file I get the date as:
> 2010-4-19
> Which does not allow my plugin to trigger.
>
> I've modified the Timezone in my WordPress settings to be my local timezone
> and no luck. Any thoughts?
>


More information about the wp-testers mailing list