From dd61f247b14215f10848a378b52bb980824f85fc Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 10 Sep 2017 08:52:14 +0000 Subject: [PATCH] fhem.pl: add $today for use in Perl-Commands (Forum #76444) git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@15037 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- docs/commandref_frame.html | 3 ++- docs/commandref_frame_DE.html | 3 ++- fhem.pl | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/commandref_frame.html b/docs/commandref_frame.html index 228f338da..e27684a8b 100644 --- a/docs/commandref_frame.html +++ b/docs/commandref_frame.html @@ -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.
Additionally the variabe $we is 1 if it is weekend (i.e $wday == 0 or $wday == 6), and 0 otherwise. If the holida2we diff --git a/docs/commandref_frame_DE.html b/docs/commandref_frame_DE.html index 0ae5c5209..6ec95de13 100644 --- a/docs/commandref_frame_DE.html +++ b/docs/commandref_frame_DE.html @@ -1796,7 +1796,8 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet: für die Verwendung in PERL-"oneliners" eingeführt (s. unter perldoc -f localtime). Ausnahmen: $month hat einen Wertebereich von 1 to 12 und $year ist korrigiert von 1900. - Weiterhin enthät $hms die Zeit in dem HH:MM:SS Format. + Weiterhin enthät $hms die Zeit in dem HH:MM:SS Format und $today den + aktuellen Datum in YYYY-MM-DD Format.
Die Variabe $we hat den Wert 1 wenn der abgefragte Tag auf ein Wochenende diff --git a/fhem.pl b/fhem.pl index b22fb2bcd..bdbbda53c 100755 --- a/fhem.pl +++ b/fhem.pl @@ -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 %