timeInRange — checking if the present time hits the specified interval of time and day of week.

Description:

u8 timeInRange(HH:MM-HН:MM|day1[, day2…]);

Checking if the present time hits the specified interval of time HH:MM-HН:MM and one or more specified days of week day1.

List of parameters:

HH:MM-HН:MM

Start time and end time of checked interval of time. Time is set in the format of HH:MM.

day1

Days of week separated by commas. Two-character symbols according to American standard are use for denoting the days of week:

· su – Sunday

· mo – Monday

· tu – Tuesday

· we – Wednesday

· th – Thurthday

· fr – Friday

· sa – Saturday


Return values:

· Returns 0 in case if the present time do not hit the specified interval of time or the present day do not correspond to the specified days.

· Returns value not 0 in case if the present time hits the specified interval of time within the days specified.

Example:

<item addr="524:248" name="Test for timeInRange function" type="script">

V-ID/V-ADDR
{
	if(opt0())
	{ 
		u8 res = timeInRange(9:00-18:00|mo, tu, we, th, fr);

		if(res != 0) 
		{
			setStatus(@exciterId():32, {1, "Working time!"});
		}

		res = timeInRange(18:01-8:59|mo, tu, we, th, fr);

		if(res != 0) 
		{
			setStatus(@exciterId():32, {1, "Non-working period!"});
		}

		res = timeInRange(00:00-23:59|su, sa);

		if(res != 0) 
		{
			setStatus(@exciterId():32, {1, "Weekends!"});
		}

	}
}

</item>

The result of performing the example:

Depending on the day of week and time of day when clicking the element script the following messages will be displayed in the interface: “Working time!”, “Non-working period!” or “Weekends!”.