Is there a way to determine if a timestamp is between 2 times of the
day? For example, I need to know if a time is between 12:00 am and 4:00
am. The field I’m looking at has a full timestamp (i.e. 2009-06-25
19:58:37) The date is irrelevant, I just need to know if the time of day
was in range.
yep
assuming the timestamp is returning a DateTime object, just call the
hour method on that
eg.
@user.created_at.hour would return an integer that is between 0 and 23
so
@user.created_at.hour > 0 and @user.created_at.hour < 4
Gavin