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”

  1. Xavier Celibataire Says:
    Very handy indeed. I do think though that the Google Gods aren't that easily impressed. But you keep the faith :)

Sorry, comments are closed for this article.