method

beginning_of_month

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Calculations
beginning_of_month() public

Returns a new date/time at the start of the month.

today = Date.today # => Thu, 18 Jun 2015
today.beginning_of_month # => Mon, 01 Jun 2015

DateTime objects will have a time set to 0:00.

now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000
now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000
Show source
Register or log in to add new notes.