Right now, we will figure out how to get the current time and print the time in different various arrangements?
Source Code and Output to get and print Current Time
<?php
/*print time in HH:MM:SS*/
print "Current time in HH:MM:SS format: " .date("h:i:s");
print "</br>";
/*print time in HH:MM:SS*/
print "Current time in HH:MM:SS am/pm format: " .date("h:i:s a");
print "</br>";
/*print time in HH:MM:SS*/
print "Current time in HH:MM:SS AM/PM format: " .date("h:i:s A");
print "</br>";
/*print time in HH:MM:SS*/
print "Current time in HH24:MM:SS format: " .date("H:i:s A");
print "</br>";
?>
Output
Current time in HH:MM:SS format: 02:29:27
Current time in HH:MM:SS am/pm format: 02:29:27 pm
Current time in HH:MM:SS AM/PM format: 02:29:27 PM
Current time in HH24:MM:SS format: 14:29:27 PM