Mike Mike - 1 month ago 5x
Ruby Question

Rails DateTime.now without Time

I need to use DateTime.now to grab the current date, and "strip off" the time.

For example, this shows what I don't want:

DateTime.now => Sat, 19 Nov 2011 18:54:13 UTC +00:00

This shows what I do want:
DateTime.now.some_operation => 2011-11-06 00:00:00 UTC


Try DateTime.now.to_date or DateTime.now.beginning_of_day