Skip to content

Instantly share code, notes, and snippets.

@cangevine
Created December 12, 2013 16:46
Show Gist options
  • Save cangevine/7931114 to your computer and use it in GitHub Desktop.
Save cangevine/7931114 to your computer and use it in GitHub Desktop.
Get time and date information from PHP
<?php
// Get one aspect of the date, save it as a variable
$hour = date("H");
$minute = date("i");
$ampm = date("A");
// For more information on specifying the format with the letter codes, check here:
// http://www.php.net/manual/en/function.date.php
print("<p>$hour</p>");
print("<p>$minute</p>");
print("<p>$ampm</p>");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment