Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Get the Current Date and Time in PHP

phpCopy<?php
date_default_timezone_set('Europe/Amsterdam');    
$DateAndTime = date('m-d-Y h:i:s a', time());  
echo "The current date and time in Amsterdam are $DateAndTime.
";
date_default_timezone_set('America/Toronto');    
$DateAndTime2 = date('m-d-Y h:i:s a', time());  
echo "The current date and time in Toronto are $DateAndTime2.";
?>
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #Get #Current #Date #Time #PHP
ADD COMMENT
Topic
Name
9+9 =