Get current date and time in PHP - Mostlikers

29 July, 2014

Get current date and time in PHP

Get your current date and time in php, set your location default time zone get your current time zone.
manually set the timezone by using date_default_timezone_set before the date() or time().

php time

ASIA Time

<?php
date_default_timezone_set ("Asia/Calcutta");
$dateofreg1=date('m/d/Y h:i:s a', time());
echo "The current india timezone is: " . $dateofreg1; 
?>


Australia Time zone

<?php
date_default_timezone_set('Australia/Melbourne');
$dateofreg1=date('m/d/Y h:i:s a', time());
echo "The current india timezone is: " . $dateofreg1; 
?>



America Time Zone

<?php
date_default_timezone_set('America/New_York');
$dateofreg1=date('m/d/Y h:i:s a', time());
echo "The current india timezone is: " . $dateofreg1; 
?>
change timezone get current time and date 

No comments:

Post a comment