Skip to content

Instantly share code, notes, and snippets.

@pascalchevrel
Created September 30, 2014 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pascalchevrel/8bd3a0dfa284ca349ddf to your computer and use it in GitHub Desktop.
Save pascalchevrel/8bd3a0dfa284ca349ddf to your computer and use it in GitHub Desktop.
Get Timestamp of svn commit for a file
<?php
function getSVNCommitTimestamp($file)
{
exec("svn info --xml ${file} 2>/dev/null", $output, $return_code);
if ($return_code) {
return false;
}
$file = new SimpleXMLElement(implode('', $output));
$date = new DateTime($file->entry->commit->date);
return $date->getTimestamp();
}
var_dump(getSVNCommitTimestamp('activism.txt'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment