Rails DateTime.now without Time
You can use one of the following:
DateTime.current.midnight
DateTime.current.beginning_of_day
DateTime.current.to_date
What you need is the function strftime:
Time.now.strftime("%Y-%d-%m %H:%M:%S %Z")
What about Date.today.to_time
?
You can use just:
Date.current
If you're happy to require 'active_support/core_ext'
, then you can use
DateTime.now.midnight # => Sat, 19 Nov 2011 00:00:00 -0800