Get hour from particle and use the value into a IF

Hi,

I want get current hour from particle and use that value inside an if for sample:

IF hour < 16 {
}

I don’t know how put the hour inside a variable and after use it inside the if.

Thanks

Roberto

The relevant docs is here: https://docs.particle.io/reference/firmware/electron/#time

You should be looking for something like:

if (Time.hour() < 16) {
 int currentHour = Time.hour()
}
2 Likes

Thank you, works fine.