Skip to content

Instantly share code, notes, and snippets.

@jferris
Created November 16, 2011 17:05
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jferris/1370669 to your computer and use it in GitHub Desktop.
Save jferris/1370669 to your computer and use it in GitHub Desktop.
Figure out what strtime characters are supported by your Ruby
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment