Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Get the Current Date and Time in PHP

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