Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

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 by rietta.com #
 
PREVIOUS NEXT
Tagged: #current #year #ruby
ADD COMMENT
Topic
Name
4+1 =