Created
February 27, 2017 14:27
-
-
Save timgentry/c166690a91583dc277615a3b9d8a61be to your computer and use it in GitHub Desktop.
Parse subversion last-changed-date timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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