Thursday, July 30, 2015

(A-Z) Date Time Formatting in Ruby

Code
Output
t.strftime('%a') => Thu
t.strftime('%b') => Jan
t.strftime('%c') => Thu Jan 23 16:38:02 2014
t.strftime('%d') => 23
t.strftime('%e') => 23
t.strftime('%g') => 14
t.strftime('%h') => Jan
t.strftime('%j') => 023
t.strftime('%k') => 16
t.strftime('%l') => 4
t.strftime('%m') => 01
t.strftime('%o') => %o
t.strftime('%p') => PM
t.strftime('%q') => %q
t.strftime('%r') => 04:38:02 PM
t.strftime('%s') => 1390475282
t.strftime('%t') => # Not Useful
t.strftime('%u') => 4
t.strftime('%v') => 23-JAN-2014
t.strftime('%w') => 4
t.strftime('%x') => 01/23/14
t.strftime('%y') => 14
t.strftime('%z') => +0530


For more date formatting visit https://gist.github.com/akshaymohite/8578315