If condition for a specifiq time range

Hi
I will be really great full if any one can help me with bellow

bellow is the basic condition

if sip_hash[“L-A”].to_i == 0 and sip_hash[“LB”].to_i == 0
color_count_local=1
else
puts “No issues”
end

but I need to add the Hour range, if the time between 7 am to 4 am

if sip_hash[“L-A”].to_i == 0 and sip_hash[“LB”].to_i == 0 and time
between 7am to 4 am
color_count_local=1
else
puts “No issues”
end

How do i get this ?
Please help me with this.
Thank

require ‘time’
require ‘date’

today = Date.today

four_am = Time.new(
year=today.year,
month=today.month,
day=today.day,
hour=4,
)

seven_am = Time.new(
year=today.year,
month=today.month,
day=today.day,
hour=7,
)

now = Time.now

if now > four_am and now < seven_am
puts ‘yes’
else
puts ‘no’
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs