Encode/Decode Dates

Return to Menu

Timecode: 1328537974
ISO8601 format: 2012-02-06T10:19:34-04:00 using encodeDateTime()
Timecode: 1328537974 using decodeDateTime()

Source - encodedecodedates.php

<?php require_once('config.inc.php');  ?>
<html>
<body>
<h1>Encode/Decode Dates</h1>
<a href=index.php>Return to Menu</a><p>
 
<?php
 
	if (!class_exists('SimpleDB')) require_once('sdb.php');  
 
	$thetime = Time();  // get current time/date
 
	echo("Timecode: $thetime<br>");
 
	$now = SimpleDB::encodeDateTime($thetime);
	echo("ISO8601 format: $now using encodeDateTime()<br>");
 
	$dt = SimpleDB::decodeDateTime($now);
 
	echo("Timecode: $dt using decodeDateTime()<p>");
?>
 
Copyright &copy; 2010, Rich Helms.  All rights reserved.
<br><a href=http://webmasterinresidence.ca/simpledb/>http://webmasterinresidence.ca/simpledb/</a>
<br><i>Amazon SimpleDB Developer Guide</i> by Prabhakar Chaganti, Rich Helms <a target=_blank href="http://www.packtpub.com/amazon-simpledb-database-developer-guide/">Packt Publishing Ltd</a>
 
</body>
</html>
Copyright © 2010, Rich Helms. All rights reserved.
http://webmasterinresidence.ca/simpledb/
Amazon SimpleDB Developer Guide by Prabhakar Chaganti, Rich Helms Packt Publishing Ltd