Posted on 20-09-2007
Filed Under (Code Snippets) by dotWdot

Converting a unix timestamp into ISO 8601 is easy in php version 5+. Its just date(”c”,$date)  or whatever. But for all the people that don’t yet have php 5 installed, heres how I got php to convert a unix timestamp into ISO 8601:

 Note:

  • in this example I am using it to provide an ISO 8601 timestamp for when the file ‘test.php’ was last modified!
  • Also the last bit ‘+00:00′ isn’t dynamic - you should modify this to your timezone (no easy date function for this pre php5 so just set it and leave it!

$last_modified = filemtime(”test.php”);
$iso_8601_lastmod = date(”Y-m-d\TH:i:s+00:00″, $last_modified);

    Read More   
Post a Comment
Name:
Email:
Website:
Comments:
    • e-business, SEO, Internet Theory and a little Coding...


  • Blogroll