Despite the WordPress Options' Timezone setting for the whole WordPress installation, is it necessary to declare the default timezone in all the date/time places in a WP theme/plugins?

echo date('d M Y - D - h:i A');

Suppose I'm handling with something where I'm checking whether the date&time is equals to TODAY. You know what "Today" means is a bit variable - variable to server time, variable to local time etc.

That's why I'm looking for a standard procedure to follow in WP projects, whether to set the default timezone each and every time (or do I call them always in the header?) or to avoid them as WordPress itself declared that already (just tune that before).

I'm just looking for a standard procedure - what to follow...

1 Answer 1


I think the safest way to handle it is to use the API to get the local time as set in WordPress settings-

$today = date( 'd M Y - D - h:i A', current_time( 'timestamp' ) );

EDIT- apparently current_time also accepts a PHP date string now as of version 3.9, so you can use that directly in place of date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.