Displaying 4 results from an estimated 4 matches for "date_time12".
Did you mean:
date_time
2006 May 21
5
model methods
Hello everyone,
In my model, I have
def leave_at_formatted
leave_at.strftime("%I:%M %p")
end
I was wondering if there were any way to define to_s for leave_at in order
to get the same result?
Thanks!
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on
this, I think it''s time to ask the list.
Postgres stores a Date in YYYY-MM-DD format. My users want the dates
in MM/DD/YYYY format.
Sure, I could explicitly convert it on the app level every place where
a date is displayed, but that seemed like a DRY violation.
I thought I''d be clever and simply
2006 May 10
2
Rails, Postgres and the Date Field.
...est'', 12345, ''0010-01-01'', 12345, 2, ''test'', ''test@test.com'');
I already put the following code in my environment.rb.
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(
:default => ''%m/%d/%Y'',
:date_time12 => "%m/%d/%Y %I:%M%p",
:date_time24 => "%m/%d/%Y %H:%M",
)
And the date are still displayed as year, month, day.
How can I change this behavior?
Thanks in advance.
Fernando Lujan
2006 Jan 09
5
Formatting timestamp objects
I want to print my timestamp objects in a specific format. I want to print
a date like this:
Sunday, January 8 2006
I don''t want it to print January 08.
For the time, I want it to look like this:
9:08 pm
Not 09:08 and lower case PM. I created these methods:
def format_date(date)
date.strftime("%A, %B #{date.day} #{date.year}")
end
def format_time(date)
if