Skip to content

Instantly share code, notes, and snippets.

@timgentry
Created February 27, 2017 14:27
Show Gist options
  • Save timgentry/c166690a91583dc277615a3b9d8a61be to your computer and use it in GitHub Desktop.
Save timgentry/c166690a91583dc277615a3b9d8a61be to your computer and use it in GitHub Desktop.
Parse subversion last-changed-date timestamp
require 'time'
def last_changed_date
return @last_changed_date if @last_changed_date
timestamp = `svn info --show-item last-changed-date --no-newline`
# timestamp = "2017-02-27T13:18:11.822530Z"
@last_changed_date = DateTime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%L').to_time
end
puts last_changed_date.inspect
puts last_changed_date.to_i.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment