Thanks Frederick.

If I do that, it stores the date of the day the record was updated or
created, I would still need to extract just the time portion and
compare it. Is there a way to do that?

My use case is that on May 1st, customer makes reservation beween
7-9pm for May 5th. The record is stored with timestamps of 5/1/2010:
7-9 pm.

When he shows up on May5th, I need to validate Time.now.. whether it's
between 7 - 9.
On May 17, 12:17 am, Frederick Cheung <[email protected]>
wrote:
> On May 17, 6:29 am, badnaam <[email protected]> wrote:
>
> > I am storying a column called start time and endtime, both having
> > mysql type "time".
>
> [snip]
>
>
>
> > The time gets stored just fine (though in 24 hour format, which is
> > another headache), but when I extract this time to compare it to
> > Time.now, to figure out, if "now" is between end and start time, the
> > time returned is something like Sat Jan 01 15:00:00 UTC 2000, which is
> > nowhere in 2010.
>
> > Why is this happening? Whats the best way to store start and end time
> > to compare later on with "now".
>
> The mysql time type is a pure time of day type (ie no date component).
> You want a datetime column.
>
> Fred
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to