Like in PHP you would put:
$time = date("H");
And that would give you the hour.
Then I want to check if $time equals something, and if so, do something, if not do something else, like in php you would do:
if ($time == "10") { do something }
if ($time!= "10") { do something else }
i am really used to PHP and know nothing about perl. Is there a manual or function list somewhere?
$sec, $min, and $hour are the seconds, minutes, and hours of the specified time. $mday is the day of the month, and $mon is the month itself, in the range 0..11 with 0 indicating January and 11 indicating December. $year is the number of years since 1900. That is, $year is 123 in year 2023. $wday is the day of the week, with 0 indicating Sunday and 3 indicating Wednesday. $yday is the day of the year, in the range 0..364 (or 0..365 in leap years.) $isdst is true if the specified time occurs during daylight savings time, false otherwise.
--
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$switch = "off";
if (($hour >= "00")&&($hour =< "07")) { $switch = "on"; }
if ($switch == "on") { do something }
if ($switch == "off") { do something else }
--
Is that correct?
Instead of asking for the year, month, day, week etc, couldn't you just have:
($sec,$min,$hour) = localtime(time);
?