Skip to content
Related Articles

Related Articles

Ruby | Time dst?() function

View Discussion
Improve Article
Save Article
  • Last Updated : 07 Jan, 2020
View Discussion
Improve Article
Save Article

The dst?() is an inbuilt method in Ruby returns true if time occurs during Daylight Saving Time in its time zone otherwise false

Syntax: time.dst?()

Parameters: The function accepts no parameter

Return Value: It returns true if time occurs during Daylight Saving Time in its time zone otherwise false

Example 1:




# Ruby code for dst?() method
  
# Include Time
require 'time'
  
# Declaring time 
a = Time.new(2000, 12, 23)
  
# Prints boolean value
puts a.dst?()

Output:

false

Example 2:




# Ruby code for dst?() method
  
# Include Time
require 'time'
  
# Declaring time 
a = Time.now()
  
# Prints boolean value
puts a.dst?()

Output:

false
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!