2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhem.pl: add $today for use in Perl-Commands (Forum #76444)

git-svn-id: https://svn.fhem.de/fhem/trunk@15037 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-09-10 08:52:14 +00:00
parent 2c9e3fe73c
commit 8d5b14b851
3 changed files with 5 additions and 2 deletions

View File

@ -1667,7 +1667,8 @@ The following local attributes are used by a wider range of devices:
$mday, $month, $year, $wday, $yday, $isdst are available in the perl
oneliners (see also perldoc -f localtime). Exceptions: $month is in the
range of 1 to 12, and $year is corrected by 1900 (as I would expect).
Additionally the variable $hms contains the time in the HH:MM:SS format.
Additionally the variable $hms contains the time in the HH:MM:SS format and
$today the current date in YYYY-MM-DD format.
<br>
Additionally the variabe $we is 1 if it is weekend (i.e $wday == 0 or
$wday == 6), and 0 otherwise. If the <a href="#holiday2we">holida2we</a>

View File

@ -1796,7 +1796,8 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
f&uuml;r die Verwendung in PERL-&quot;oneliners&quot; eingef&uuml;hrt (s.
unter perldoc -f localtime). Ausnahmen: $month hat einen Wertebereich von 1
to 12 und $year ist korrigiert von 1900.
Weiterhin enth&auml;t $hms die Zeit in dem HH:MM:SS Format.
Weiterhin enth&auml;t $hms die Zeit in dem HH:MM:SS Format und $today den
aktuellen Datum in YYYY-MM-DD Format.
<br>
Die Variabe $we hat den Wert 1 wenn der abgefragte Tag auf ein Wochenende

View File

@ -1061,6 +1061,7 @@ AnalyzePerlCommand($$;$)
}
$month++;
$year+=1900;
my $today = sprintf('%04d-%02d-%02d', $year,$month,$mday);
if($evalSpecials) {
$cmd = join("", map { my $n = substr($_,1); # ignore the %