strftime cheatsheet
Submitted by specialj on Sat, 2008-06-07 04:11.
I know there are other cheatsheets out there but I want one that’s close to home. I find myself needing to look up strftime parameters quite often in my Rails development work. Particularly difficult is remembering the different forms for the same time item. Anyway, here is a list formatted for my usage.
Names
- month name - %b (Abbr), %B (Full)
- day of week name - %a (Abbr), %A (Full)
- timezone - %Z (Name), %z (UTC offset)
Dates
- year - %y (2-digit), %Y (4-digit)
- month - %m (leading zero)
- day - %d (leading zero), %e (leading space)
- hour (24-hour) - %H (leading zero), %k (leading space)
- hour (12-hour) - %I (leading zero), %l (leading space)
- am/pm - %p (Uppercase), %P (lowercase)
- minute - %M (leading zero)
- second - %S (leading zero)
Trackback URL for this post:
http://hightechsorcery.com/trackback/147




Recent comments
1 week 4 days ago
2 weeks 2 days ago
2 weeks 2 days ago
2 weeks 2 days ago
2 weeks 4 days ago
2 weeks 6 days ago
5 weeks 3 days ago
5 weeks 3 days ago
5 weeks 3 days ago
5 weeks 5 days ago