Horje
get current year in ruby Code Example
get current year in ruby
# Using the Time class
current_year = Time.new.year
current_year = Time.now.year

# Using the Date class
current_year = Date.today.year

# Using the DateTime class
current_year = DateTime.now.year
Source: rietta.com




Ruby

Related
rails undo scaffold Code Example rails undo scaffold Code Example
rails include route helpers in console Code Example rails include route helpers in console Code Example
rails g resource Code Example rails g resource Code Example
rails parallel tests Code Example rails parallel tests Code Example
specify ruby version in gemfile Code Example specify ruby version in gemfile Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
21