Return to Snippet

Revision: 2132
at January 1, 2007 11:10 by alexwilliams


Updated Code
def format_date(date, use_time = false)
    if use_time == true
        ampm = date.strftime("%p").downcase
        new_date = date.strftime("%B %d, %Y at %I:%M" + ampm)
    else
        new_date = date.strftime("%B %d, %Y")
    end
end

Revision: 2131
at January 1, 2007 11:07 by alexwilliams


Initial Code
def format_date(date, use_time = false)
    if use_time == true
        ampm = date.strftime("%p").downcase
        new_date = date.strftime("%B %d, %Y at %I:%M" + ampm)
    else
        new_date = date.strftime("%B %d, %Y")
    end
end

Initial URL

                                

Initial Description

                                

Initial Title
Formatting a date with or without the time

Initial Tags
date, format, rails, ruby

Initial Language
Ruby