public
Created

Figure out what strtime characters are supported by your Ruby

  • Download Gist
time_formats.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/env ruby
 
require 'rubygems'
require 'active_support/core_ext'
 
chars = (('a'..'z').to_a + ('A'..'Z').to_a)
 
time = Time.now.beginning_of_month
twelve_hours_from_now = 12.hours.from_now
end_of_next_month = 1.month.from_now.end_of_month
 
chars.each do |char|
printf("%-8s %-25s %-25s %-25s\n",
char,
time.strftime("%#{char}").rstrip,
twelve_hours_from_now.strftime("%#{char}").rstrip,
end_of_next_month.strftime("%#{char}").rstrip)
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.