tengo un código que lo produce erróneamente y estoy pensando que debe haber una mejor manera de verificar el tiempo> 9.30 a.m. y el tiempo < 4 p. M. . Cualquier idea es muy apreciada.compruebe el tiempo entre 9.30 a 4 ruby
def checkTime
goodtime=false
if(Time.now.hour>9 and Time.now.min>30) then
if(Time.now.hour<16) then
goodtime=true
else
# do nothing
end
elsif Time.now.hour>9 and Time.now.hour<16 then
goodtime=true
else
# do nothing
end
return goodtime
end
este funcionó perfecto para mí. muchas gracias. – junkone
No puedo conseguir que funcione en 2.0.0, ya que informa: 'TypeError: no puede iterar desde Time'. La conversión de los puntos finales de rango con '.to_i', y luego la comparación con' t.to_i' funciona, sin embargo. – tamouse