Date formats for computer processing are prescribed by ISO8601.  This link gives a good discussion and examples of permissible variations on the format.
See http://en.wikipedia.org/wiki/ISO_8601

In MySQL, date fields are usually carried in the format DATE and DATETIME.  
See http://dev.mysql.com/doc/refman/5.0/en/datetime.html

These are very "relaxed" fields.  You can insert invalid dates (such as February 31) and MySQL will accept these.

A Unix timestamp is a number of seconds.  The PHP man page for time() describes this.
See http://us.php.net/manual/en/function.time.php

Recent versions of PHP can handle negative timestamps,  Otherwise, the timestamp counter begins at the inception of the Unix Epoch (January 1 1970 00:00:00 GMT).

You can add and subtract Unix timestamps to determine the number of seconds between two events.  You can sort Unix timestamps when you treat them as numeric values.


Example of getting the current time into a Unix timestamp:
$unix_timestamp = time();


Example of getting the current time plus one hour into a Unix timestamp:
$unix_timestamp = time() + 60 * 60; // SIXTY SECONDS IN A MINUTE * SIXTY MINUTES IN AN HOUR


The PHP command date() turns a Unix timestamp into a human-readable date.  
See http://us3.php.net/manual/en/function.date.php

Example of getting an ISO8601 date from a Unix timestamp:
$iso_date_string = date('Y-m-d\TH:i:s', $unix_timestamp);

You can sort ISO8601 dates when you treat them as character strings.

Example of getting a detailed human-readable date and time from a Unix timestamp:
$man_date_string = date('g:ia T \o\n D, M j, Y', $unix_timestamp);


The PHP command strtotime() turns almost any human-readable date into a Unix timestamp.  
See http://us3.php.net/manual/en/function.strtotime.php
$unix_timestamp = strtotime('tomorrow');
$unix_timestamp = strtotime('yesterday 3:00pm');
$unix_timestamp = strtotime('January 3, 2007');
$unix_timestamp = strtotime('+ 2 weeks');
$unix_timestamp = strtotime('Incomprehensible'); // RETURNS FALSE

You can use date() and strtotime() together in very powerful ways.  Convert ISO8601 to human-readable date:
$man_date_string = date('g:ia T \o\n D, M j, Y', strtotime($iso_date_string));


The PHP command mktime() returns a Unix timestamp according to an argument list.  
See http://us3.php.net/manual/en/function.mktime.php
The arguments in order are hour, minute, second, month, day, year.  Because mktime() will work with out-of-range arguments, it is useful for date calculations.
$last_month = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); // WORKS NO MATTER WHAT MONTH IT IS!
$man_date_string = date('g:ia T \o\n D, M j, Y', mktime(12, 0, 0, date("m"), date("d")+30, date("Y"))); // HIGH NOON THIRTY DAYS FROM NOW


When you are working with human input to a computer program, it's good to know what works with strtotime().  The script in the code snippet will tell you.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
<?php // RAY_strtotime.php 
// GET VARIABLES
extract($_GET); 
// IF WE HAVE INPUT, TRY TO PROCESS
if ($s!= '') { 
// USE strtotime() FUNCTION
	$x = strtotime($s); 
// TEST FOR SUCCESS OR FAILURE
	if ($x === FALSE)  {
		echo "<strong>Honk!</strong><br /> <u>$s</u> not useful with strtotime() <br />  \n";
	} else { 
// ON SUCCESS, PRINT THE RESULTS
		echo "<strong>Bingo</strong><br /> <u>$s</u> works with strtotime() <br />  \n";
		echo "The integer timestamp value is $x<br />\n";
		$y = date('l dS \o\f F Y h:i:s A', $x);
		echo "The textual date is $y<br />\n";
	}
} // END OF PROCESSING INPUT 
?>
<html><head><title>PHP FUNCTION strtotime(<?=$s?>)</title></head><body>
<form method="get" action="<?=$PHP_SELF?>">
<br />To test a string for a valid date/time, type it here:<input type="text" name="s" />
<input type="submit" value="Go" />
</form></body></html>