Generate a timestamp string in Ruby
June 10th, 2009
In the hope that the Google Gods will help me next time I need this :-)
An easy way to generate a human-readable timestamp string, following the ISO 8601 standard, is:
Time.now.utc.iso8601.gsub(’-’, ’’).gsub(’:’, ’’)
Very handy if you need a timestamp in a file you’re writing.
1 Response to “Generate a timestamp string in Ruby”
Sorry, comments are closed for this article.

June 29th, 2009 at 08:12 AM Very handy indeed. I do think though that the Google Gods aren't that easily impressed. But you keep the faith :)