H
– 24-hour format of an hour (00 to 23)h
– 12-hour format of an hour with leading zeros (01 to 12)i
– Minutes with leading zeros (00 to 59)s
– Seconds with leading zeros (00 to 59)a
– Lowercase Ante meridiem and Post meridiem (am or pm)The example below outputs the current time in the specified format:
<?php echo “The time is “ . date(“h:i:sa”); ?> |
Keep in mind that the PHP date() function returns the current date and time of the server! |