Rails DateTime.now without Time Rails DateTime.now without Time ruby ruby

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?