Ruby strftime() method arguments

Just for reference strftime() arguments in ruby. Usage Time.now.strftime(“%B/%d/%Y”). Got this from http://snippets.dzone.com/tag/strftime

%a  weekday name.
%A  weekday name (full).
%b  month name.
%B  month name (full).
%c  date and time (locale)
%d  day of month [01,31].
%H  hour [00,23].
%I  hour [01,12].
%j  day of year [001,366].
%m  month [01,12].
%M  minute [00,59].
%p  AM or PM
%S  Second [00,61]
%U  week of year (Sunday)[00,53].
w  weekday [0(Sunday),6].
W  week of year (Monday)[00,53].
x  date (locale).
%X  time (locale).
%y  year [00,99].
%Y  year [2000].
%Z  timezone name.

Related posts:

  1. Ruby Strftime Day Without the Leading Zero
  2. Build Your Own Calendar in Rails without any Plugins in less than 10 lines of Ruby Code
  3. Set Cron Job to Run Every Five Minutes for a Ruby on Rails Rake Task
  4. Override to_param method in model to get pseudo permalinks without any work
  5. Yield a Block within Rails Helper Method with Multiple Content_tags Using Concat
This entry was posted in Programming, Ruby on Rails and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>