Timezone

Setting the Default Timezone for PHP In WordPress

If you want to Display a post in different timezone the you should workout some php function in grab it.
It necessary when you show a online event or online live video. if you want to show the event or a post in local time you should follow bellow steps:

<span class="post-time-date">
<!--?php date_default_timezone_set('America/Los_Angeles');
echo date("M. j - g A", time());
?--> PST
</span>
<span>/</span>
<span class="post-time-date">
<!--?php date_default_timezone_set('US/Eastern');
echo date("M. j - g A", time());
?--> EST
</span>

Here ‘America/Los_Angeles’ Los Angeles Local date/time function. You can Replace it by your desire timezone.

You can get your desire timezone from here.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

0 Shares
Tweet
Share
Pin
Share