Advertisement
Shaun_B

Time and date in PHP

Oct 23rd, 2012
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2. /**
  3.  * This is a quick demonstration of getting the current time with PHP
  4.  * using the built-in APIs. Simple.
  5.  *
  6.  * @author: Shaun B
  7.  * @date: 2012-10-23
  8.  **/
  9.   $timeZone = date_default_timezone_get();
  10.   if( $timeZone != 'Europe/London' ) {
  11.       // Set your own time zone if needed...
  12.       date_default_timezone_set('Europe/London');
  13.   }
  14.   $timeStamp = strtotime('now');
  15.   echo $timeStamp . ' becomes ' . date('l dS \o\f F Y h:i:s A', $timeStamp)
  16.        . ' when converted to Human. <br />';
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement