Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shunchu/3175001 to your computer and use it in GitHub Desktop.
Save shunchu/3175001 to your computer and use it in GitHub Desktop.

Revisions

  1. shunchu revised this gist Jul 25, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions convert-seconds-into-hh-mm-ss-in-ruby.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    t = 236 // seconds
    t = 236 # seconds
    Time.at(t).utc.strftime("%H:%M:%S")
    => "00:03:56"

    // Reference
    // http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
    # Reference
    # http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time
  2. shunchu renamed this gist Jul 25, 2012. 1 changed file with 0 additions and 0 deletions.
  3. shunchu created this gist Jul 25, 2012.
    6 changes: 6 additions & 0 deletions convert-seconds-into-hh-mm-ss-in-ruby
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    t = 236 // seconds
    Time.at(t).utc.strftime("%H:%M:%S")
    => "00:03:56"

    // Reference
    // http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time