Please send questions to
st10@humboldt.edu .
<html>
<!-- datetime3.php
adapted from example from Chapter 9 of "Learning PHP 5", by
David Sklar, published by O'Reilly
adapted by: Sharon Tuttle
last modified: 11-28-06
-->
<head>
<title> playing with PHP date and time handling - 3 </title>
</head>
<body>
<h2> playing with PHP date and time handling - 3 </h2>
<?php
// return the current timestamp
$curr_time = time( );
// m - month (as a number)
// d - day of the month
// y - last two digits of year
// h - 12-hour format of the hour
// i - minutes with leading zeroes
// s - seconds with leading zeroes
print "<h3> ";
print "date('m/d/y h:i:s', \$curr_time) says: ";
print date('m/d/y h:i:s', $curr_time);
print "<br>";
print "and in one second: " . date('m/d/y h:i:s', $curr_time + 1);
print "<br>";
print "and in one minute: " . date('m/d/y h:i:s', $curr_time + 60);
print "<br>";
print "and in one hour: " . date('m/d/y h:i:s', $curr_time + (60*60));
print "<br>";
print "and in one day: " . date('m/d/y h:i:s', $curr_time + (24*60*60));
print "<br><br>\n";
// %m - month (as a number)
// %d - day of the month
// %y - last two digits of year
// %I - 12-hour format of the hour
// %M - minutes
// %S - seconds
print "strftime('%m/%d/%y %I:%M:%S', \$curr_time) says: ";
print strftime('%m/%d/%y %I:%M:%S');
print "<br>";
print "and in one second: " . strftime('%m/%d/%y %I:%M:%S',
$curr_time + 1);
print "<br>";
print "and in one minute: " . strftime('%m/%d/%y %I:%M:%S',
$curr_time + 60);
print "<br>";
print "and in one hour: " . strftime('%m/%d/%y %I:%M:%S',
$curr_time + (60*60));
print "<br>";
print "and in one day: " . strftime('%m/%d/%y %I:%M:%S',
$curr_time + (24*60*60));
print " </h3>\n";
?>
</body>
</head>