Forked from akshaymohite/Ruby STRFTIME conversion formats.rb
Last active
August 29, 2015 14:11
-
-
Save ksaynice/0f2a39723009d6e1ba4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to print strftime results | |
def print_strftime_formats(a,cur_date) | |
a.each do |format| | |
b = "%#{format}" | |
output = cur_date.strftime(b) | |
puts "t.strftime('#{b}'), => #{output}" | |
end | |
end | |
a = ('a'..'z').to_a | |
A = ('A'..'Z').to_a | |
cur_date = Time.now | |
# calling and printing strftime results on current date | |
puts "DateTime: #{cur_date}\n" | |
puts "\n\nFor a to z" | |
print_strftime_formats(a,cur_date) | |
puts "\n\nFor A to Z" | |
print_strftime_formats(A,cur_date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment