Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Zeitdifferenz berechnen

    NEWS

    • Neues Video über Aliase, virtuelle Geräte und Kategorien

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    Zeitdifferenz berechnen

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      martin_olw @haus-automatisierung last edited by

      @haus-automatisierung Ich glaube an genau dem Prinzip scheitere ich auch gerade:
      Die Kinder wollen auf unserer VIS angezeigt haben, wie viele Tage es noch bis zum Beginn der nächsten Ferien sind.
      Der schoolfree-adapter liefert mit den Datenpunkt:
      ae30985b-b0e8-4da2-b7f6-9be237ba93c1-image.png
      Möchte ich den jetzt ins Datum-Objekt-Format bringen um dann später weiter rechnen zu können, dann bekomme ich keinen Wert:
      5b19bf8d-fbdd-424b-a123-b82aa56e9406-image.png
      Wo ist denn mein Denkfehler?
      Danke für die Hilfe.

      rantanplan Codierknecht 2 Replies Last reply Reply Quote 0
      • rantanplan
        rantanplan @martin_olw last edited by

        @martin_olw Hallo
        Hier mal ein Teil aus meinem Urlaubs-Script.


        Blockly-Bild.png

        Hier der Import:

        <xml xmlns="https://developers.google.com/blockly/xml">
         <variables>
           <variable id="e9iD.-I54$~?Z|ZL+F{9">ObjektDatumAktuell</variable>
           <variable id="HS;qgmx.%$*4;[8X)sE#">Tage_bis_Urlaub</variable>
           <variable id="E:6SzWk}t@`61,$x`FXx">UrlaubStart</variable>
           <variable id="!}5U.l7kfEw/+lNM)Ab1">UrlaubEnde</variable>
           <variable id=":s,6VAIY,]GlSe|T!)9E">UrlaubsTage</variable>
           <variable id="lY?bd7V(:s+-ZYD^GnD2">TageBisUrlaubsEnde</variable>
           <variable id="=We=rhXNVW,Lr8ETlQwY">UrlaubRest</variable>
         </variables>
         <block type="on_ext" id="6Y@LIxe47B4)/e.|7dhR" x="13" y="13">
           <mutation xmlns="http://www.w3.org/1999/xhtml" items="2"></mutation>
           <field name="CONDITION">ne</field>
           <field name="ACK_CONDITION"></field>
           <value name="OID0">
             <shadow type="field_oid" id=".pH*ia^ETsdO8W,L#Gk=">
               <field name="oid">0_userdata.0.Anwesendheit.Urlaub.Urlaub_1_Anfang</field>
             </shadow>
           </value>
           <value name="OID1">
             <shadow type="field_oid" id="D*3.w}vY.)vz0,R#Xf5;">
               <field name="oid">0_userdata.0.Anwesendheit.Urlaub.Urlaub_1_Ende</field>
             </shadow>
           </value>
           <statement name="STATEMENT">
             <block type="procedures_callnoreturn" id="CruK/)nJvPeDa%r+bEx+">
               <mutation name="INIT"></mutation>
             </block>
           </statement>
         </block>
         <block type="procedures_defnoreturn" id="rK9I[^hv-APnWSk-Kt.L" x="13" y="188">
           <field name="NAME">INIT</field>
           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           <statement name="STACK">
             <block type="variables_set" id="61JC/Ih{H)?7I=v/Fm=Q">
               <field name="VAR" id="e9iD.-I54$~?Z|ZL+F{9">ObjektDatumAktuell</field>
               <value name="VALUE">
                 <block type="convert_to_date" id="h]gTUfA5G!-^/SWfcqc2">
                   <value name="VALUE">
                     <block type="time_get" id="+wNd8D]Iic8xhJ/d15iR">
                       <mutation xmlns="http://www.w3.org/1999/xhtml" format="true" language="false"></mutation>
                       <field name="OPTION">custom</field>
                       <field name="FORMAT">JJJJ-MM-TT</field>
                     </block>
                   </value>
                 </block>
               </value>
               <next>
                 <block type="variables_set" id="Lby=(fYB/_-R{ky.`{7]">
                   <field name="VAR" id="E:6SzWk}t@`61,$x`FXx">UrlaubStart</field>
                   <value name="VALUE">
                     <block type="convert_to_date" id="GPUD9FF0O`QE@2wZ2Z]N">
                       <value name="VALUE">
                         <block type="get_value" id="U}A,2^4+8S4DJ1*+F={|">
                           <field name="ATTR">val</field>
                           <field name="OID">0_userdata.0.Anwesendheit.Urlaub.Urlaub_1_Anfang</field>
                         </block>
                       </value>
                     </block>
                   </value>
                   <next>
                     <block type="variables_set" id="VKY$gdP}[3bH;+AXpBHZ">
                       <field name="VAR" id="!}5U.l7kfEw/+lNM)Ab1">UrlaubEnde</field>
                       <value name="VALUE">
                         <block type="convert_to_date" id="*R_Z}kF6`jL7+r1YL|}h">
                           <value name="VALUE">
                             <block type="get_value" id="AAJ|jBQ@iVn7U(iwE(!.">
                               <field name="ATTR">val</field>
                               <field name="OID">0_userdata.0.Anwesendheit.Urlaub.Urlaub_1_Ende</field>
                             </block>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="procedures_callnoreturn" id="W)r1+a/-`v`fZ[ERXO+3">
                           <mutation name="Berechnen"></mutation>
                         </block>
                       </next>
                     </block>
                   </next>
                 </block>
               </next>
             </block>
           </statement>
         </block>
         <block type="procedures_defnoreturn" id="L%cTl`j}R)j.9dGL(k)I" x="13" y="363">
           <field name="NAME">Berechnen</field>
           <comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
           <statement name="STACK">
             <block type="variables_set" id="U]^N4kN@1v8`~e05sV40">
               <field name="VAR" id="HS;qgmx.%$*4;[8X)sE#">Tage_bis_Urlaub</field>
               <value name="VALUE">
                 <block type="math_arithmetic" id="tBr:GvymRvpgrT1_2E5C">
                   <field name="OP">DIVIDE</field>
                   <value name="A">
                     <shadow type="math_number" id="dP0!DN7,T{IG#aQ(X~5K">
                       <field name="NUM">1</field>
                     </shadow>
                     <block type="math_arithmetic" id="PnLFGs#2s-cw!/1J~BR=">
                       <field name="OP">DIVIDE</field>
                       <value name="A">
                         <shadow type="math_number" id="*~Z?c`0?/W4QHG0KpJHa">
                           <field name="NUM">1</field>
                         </shadow>
                         <block type="math_arithmetic" id="-M?[syp1P$H*Nh}$]a07">
                           <field name="OP">DIVIDE</field>
                           <value name="A">
                             <shadow type="math_number" id="sZYs`ic+Oo%,ag+BhIV5">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="math_arithmetic" id=".@g),R`5Bd%V-TVvPRCe">
                               <field name="OP">MINUS</field>
                               <value name="A">
                                 <shadow type="math_number" id="zNwwmAotb`B#+|27Fb#g">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="variables_get" id="/MDql`:T}Q6%}xv}acQu">
                                   <field name="VAR" id="E:6SzWk}t@`61,$x`FXx">UrlaubStart</field>
                                 </block>
                               </value>
                               <value name="B">
                                 <shadow type="math_number" id="]^+vZgp!#:p]T%N^B36c">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="variables_get" id="Hp+Lv4mN+wM[eh/_kL?O">
                                   <field name="VAR" id="e9iD.-I54$~?Z|ZL+F{9">ObjektDatumAktuell</field>
                                 </block>
                               </value>
                             </block>
                           </value>
                           <value name="B">
                             <shadow type="math_number" id="/((:@f|[96!NnwHIVNTY">
                               <field name="NUM">60000</field>
                             </shadow>
                           </value>
                         </block>
                       </value>
                       <value name="B">
                         <shadow type="math_number" id="~9.YMbwQLoRv?I}y|,zu">
                           <field name="NUM">60</field>
                         </shadow>
                       </value>
                     </block>
                   </value>
                   <value name="B">
                     <shadow type="math_number" id="C?D)nEQfRpF}t))Ms*|j">
                       <field name="NUM">24</field>
                     </shadow>
                   </value>
                 </block>
               </value>
               <next>
                 <block type="debug" id="~N2Vh!EKK-T#|6INP{44">
                   <field name="Severity">info</field>
                   <value name="TEXT">
                     <shadow type="text" id="D1:c+o,B.N=Qc1g;f;/a">
                       <field name="TEXT">test</field>
                     </shadow>
                     <block type="variables_get" id="?DZEd@z3v90wdaK@|rqA">
                       <field name="VAR" id="HS;qgmx.%$*4;[8X)sE#">Tage_bis_Urlaub</field>
                     </block>
                   </value>
                   <next>
                     <block type="variables_set" id="5VU4?Mv4:2huebRFP11,">
                       <field name="VAR" id=":s,6VAIY,]GlSe|T!)9E">UrlaubsTage</field>
                       <value name="VALUE">
                         <block type="math_arithmetic" id="noz1b%8sh`#Bp#SsU0?H">
                           <field name="OP">ADD</field>
                           <value name="A">
                             <shadow type="math_number" id="sf$^_`Ao=`!RV(v@Lt#x">
                               <field name="NUM">1</field>
                             </shadow>
                             <block type="math_arithmetic" id="@{vaElI@,iXl5vX#c|5W">
                               <field name="OP">DIVIDE</field>
                               <value name="A">
                                 <shadow type="math_number" id="`btQnasuTCm;qwO*%[(g">
                                   <field name="NUM">1</field>
                                 </shadow>
                                 <block type="math_arithmetic" id="PGK6{PZZ~O:7kQ3C|FG}">
                                   <field name="OP">DIVIDE</field>
                                   <value name="A">
                                     <shadow type="math_number" id="TO0C%*aX{lO5WW-:f^-R">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="math_arithmetic" id="?Att1;@%4%Q(/_jZIy5=">
                                       <field name="OP">DIVIDE</field>
                                       <value name="A">
                                         <shadow type="math_number" id="sZYs`ic+Oo%,ag+BhIV5">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="math_arithmetic" id="EsiyAfA21*3NvTDOu1I{">
                                           <field name="OP">MINUS</field>
                                           <value name="A">
                                             <shadow type="math_number" id="zNwwmAotb`B#+|27Fb#g">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="variables_get" id="q||DUO@KnmY;n6M5@)(p">
                                               <field name="VAR" id="!}5U.l7kfEw/+lNM)Ab1">UrlaubEnde</field>
                                             </block>
                                           </value>
                                           <value name="B">
                                             <shadow type="math_number" id="]^+vZgp!#:p]T%N^B36c">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="variables_get" id="Jub1/{z%N7k2B?{V%mmh">
                                               <field name="VAR" id="E:6SzWk}t@`61,$x`FXx">UrlaubStart</field>
                                             </block>
                                           </value>
                                         </block>
                                       </value>
                                       <value name="B">
                                         <shadow type="math_number" id=",,~N.K,x{XBuC]3q^9@Y">
                                           <field name="NUM">60000</field>
                                         </shadow>
                                       </value>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number" id="dfV^QOPgu#R~)QikzV|8">
                                       <field name="NUM">60</field>
                                     </shadow>
                                   </value>
                                 </block>
                               </value>
                               <value name="B">
                                 <shadow type="math_number" id="/`2,hS8}B19v5LW-$/Nu">
                                   <field name="NUM">24</field>
                                 </shadow>
                               </value>
                             </block>
                           </value>
                           <value name="B">
                             <shadow type="math_number" id="|Dqt!p.!c8?xc1YJ_$7d">
                               <field name="NUM">1</field>
                             </shadow>
                           </value>
                         </block>
                       </value>
                       <next>
                         <block type="debug" id="a%EN{P;ni)C(h+B{K/3S">
                           <field name="Severity">info</field>
                           <value name="TEXT">
                             <shadow type="text" id="D1:c+o,B.N=Qc1g;f;/a">
                               <field name="TEXT">test</field>
                             </shadow>
                             <block type="variables_get" id="7$,L@1*ag8eG-v1nnL2R">
                               <field name="VAR" id=":s,6VAIY,]GlSe|T!)9E">UrlaubsTage</field>
                             </block>
                           </value>
                           <next>
                             <block type="variables_set" id="g2^ncn{yP-~)8*P@F._l">
                               <field name="VAR" id="lY?bd7V(:s+-ZYD^GnD2">TageBisUrlaubsEnde</field>
                               <value name="VALUE">
                                 <block type="math_arithmetic" id="Xd)W`4r{ZXZ6k@3dv$VG">
                                   <field name="OP">DIVIDE</field>
                                   <value name="A">
                                     <shadow type="math_number" id="dP0!DN7,T{IG#aQ(X~5K">
                                       <field name="NUM">1</field>
                                     </shadow>
                                     <block type="math_arithmetic" id="QmpPXam~rvT+MgNX9u+,">
                                       <field name="OP">DIVIDE</field>
                                       <value name="A">
                                         <shadow type="math_number" id="*~Z?c`0?/W4QHG0KpJHa">
                                           <field name="NUM">1</field>
                                         </shadow>
                                         <block type="math_arithmetic" id="w1o15_,o{(08nPDH+V{,">
                                           <field name="OP">DIVIDE</field>
                                           <value name="A">
                                             <shadow type="math_number" id="sZYs`ic+Oo%,ag+BhIV5">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id="n}7Zo/8GqFRM_n/6*(Xt">
                                               <field name="OP">MINUS</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="zNwwmAotb`B#+|27Fb#g">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="variables_get" id="MtN9sI^REd.n7!Ll/Qok">
                                                   <field name="VAR" id="!}5U.l7kfEw/+lNM)Ab1">UrlaubEnde</field>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="]^+vZgp!#:p]T%N^B36c">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="variables_get" id="S9}r}%dv+m__+^x6JkY0">
                                                   <field name="VAR" id="e9iD.-I54$~?Z|ZL+F{9">ObjektDatumAktuell</field>
                                                 </block>
                                               </value>
                                             </block>
                                           </value>
                                           <value name="B">
                                             <shadow type="math_number" id="::-{0q`94xph2Eg|-x|U">
                                               <field name="NUM">60000</field>
                                             </shadow>
                                           </value>
                                         </block>
                                       </value>
                                       <value name="B">
                                         <shadow type="math_number" id="``T+p/C8xgM_=p5Cs^W+">
                                           <field name="NUM">60</field>
                                         </shadow>
                                       </value>
                                     </block>
                                   </value>
                                   <value name="B">
                                     <shadow type="math_number" id="_irBzMi^l+RPzF^h?J@W">
                                       <field name="NUM">24</field>
                                     </shadow>
                                   </value>
                                 </block>
                               </value>
                               <next>
                                 <block type="debug" id="o9/+lp3,%3)QZSiURon4">
                                   <field name="Severity">info</field>
                                   <value name="TEXT">
                                     <shadow type="text" id="D1:c+o,B.N=Qc1g;f;/a">
                                       <field name="TEXT">test</field>
                                     </shadow>
                                     <block type="variables_get" id=",):=#H#8/0p$Z)()K0:9">
                                       <field name="VAR" id="lY?bd7V(:s+-ZYD^GnD2">TageBisUrlaubsEnde</field>
                                     </block>
                                   </value>
                                   <next>
                                     <block type="variables_set" id="#z+4]AP}FC6-TiA_G8fA">
                                       <field name="VAR" id="=We=rhXNVW,Lr8ETlQwY">UrlaubRest</field>
                                       <value name="VALUE">
                                         <block type="math_arithmetic" id=")PIjRrt8Rul#dK}Q2soP">
                                           <field name="OP">DIVIDE</field>
                                           <value name="A">
                                             <shadow type="math_number" id="dP0!DN7,T{IG#aQ(X~5K">
                                               <field name="NUM">1</field>
                                             </shadow>
                                             <block type="math_arithmetic" id="otHOPPC!:5nC?!K.,F^V">
                                               <field name="OP">DIVIDE</field>
                                               <value name="A">
                                                 <shadow type="math_number" id="*~Z?c`0?/W4QHG0KpJHa">
                                                   <field name="NUM">1</field>
                                                 </shadow>
                                                 <block type="math_arithmetic" id="QEVx==e_%dhX0W/|#4+i">
                                                   <field name="OP">DIVIDE</field>
                                                   <value name="A">
                                                     <shadow type="math_number" id="sZYs`ic+Oo%,ag+BhIV5">
                                                       <field name="NUM">1</field>
                                                     </shadow>
                                                     <block type="math_arithmetic" id="Yq,`X1IWVW1~g05cg4f=">
                                                       <field name="OP">MINUS</field>
                                                       <value name="A">
                                                         <shadow type="math_number" id="zNwwmAotb`B#+|27Fb#g">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="We*DW*18Ms-OQ@Th]/6!">
                                                           <field name="VAR" id="!}5U.l7kfEw/+lNM)Ab1">UrlaubEnde</field>
                                                         </block>
                                                       </value>
                                                       <value name="B">
                                                         <shadow type="math_number" id="]^+vZgp!#:p]T%N^B36c">
                                                           <field name="NUM">1</field>
                                                         </shadow>
                                                         <block type="variables_get" id="VhM}N+uW*3~d(Ad/;_Ot">
                                                           <field name="VAR" id="e9iD.-I54$~?Z|ZL+F{9">ObjektDatumAktuell</field>
                                                         </block>
                                                       </value>
                                                     </block>
                                                   </value>
                                                   <value name="B">
                                                     <shadow type="math_number" id="`GF=?375Ik$qs#o}VgDC">
                                                       <field name="NUM">60000</field>
                                                     </shadow>
                                                   </value>
                                                 </block>
                                               </value>
                                               <value name="B">
                                                 <shadow type="math_number" id="mQIS:jetB*#aHBYU)0PI">
                                                   <field name="NUM">60</field>
                                                 </shadow>
                                               </value>
                                             </block>
                                           </value>
                                           <value name="B">
                                             <shadow type="math_number" id="Om9T;?}xe$%eid;W`gF0">
                                               <field name="NUM">24</field>
                                             </shadow>
                                           </value>
                                         </block>
                                       </value>
                                       <next>
                                         <block type="debug" id=")?=j68qr=z=lgz[hX?u#">
                                           <field name="Severity">info</field>
                                           <value name="TEXT">
                                             <shadow type="text" id="D1:c+o,B.N=Qc1g;f;/a">
                                               <field name="TEXT">test</field>
                                             </shadow>
                                             <block type="variables_get" id="/K3#]{E4M_i.vt9,#}uD">
                                               <field name="VAR" id="=We=rhXNVW,Lr8ETlQwY">UrlaubRest</field>
                                             </block>
                                           </value>
                                         </block>
                                       </next>
                                     </block>
                                   </next>
                                 </block>
                               </next>
                             </block>
                           </next>
                         </block>
                       </next>
                     </block>
                   </next>
                 </block>
               </next>
             </block>
           </statement>
         </block>
        </xml>
        

        Wie schon gesagt ist das ein Auszug aus einem größeren Script.
        Sollte aber funktionieren.
        Datenpunkte Urlaub_1_Anfang und Urlaub_1_Ende müsstest Du vorher anlegen.
        Ich hoffe es hilft Dir etwas weiter.

        Grüße

        1 Reply Last reply Reply Quote 0
        • Codierknecht
          Codierknecht Developer Most Active @martin_olw last edited by Codierknecht

          @martin_olw sagte in Zeitdifferenz berechnen:

          Wo ist denn mein Denkfehler?

          Welchen Typ hat der DP?
          Wenn das ein String ist und das Datum dort lediglich als Text in deutscher Formatierung eingetragen ist, muss das vorher konvertiert werden.

          6f89976f-250e-43df-9c16-d907e54ad2eb-image.png

          Edit
          Alternativ kann man auch eine Liste verwenden, um das zu konvertieren. Ist letztlich Geschmackssache.

          a43c16a4-ebe9-407b-bf1b-d4dfbff492c5-grafik.png

          M 1 Reply Last reply Reply Quote 1
          • M
            martin_olw @Codierknecht last edited by

            @codierknecht Super! Danke dir. Der DP war vom Typ String. Dank deiner Konvertierung passt es jetzt. Die Kinder sind zufrieden. 😉

            1 Reply Last reply Reply Quote 0
            • E
              exmerci last edited by

              Moin,

              ich stehe gerade komplett auf dem Schlauch.
              Ich würde gern die aktuelle Zeit in einen Datenpunkt schreiben. Welchen Zustandstyp muss das Objekt haben?
              Dann würde ich gern mit einem Trigger jeden Tag das Objekt abfragen und wenn es länger als 5 Tage her ist, eine Aktion auslösen.
              Ich weiß im Augenblick nicht mal, wie ich anfangen soll.

              Homoran 1 Reply Last reply Reply Quote 0
              • Homoran
                Homoran Global Moderator Administrators @exmerci last edited by

                @exmerci sagte in Zeitdifferenz berechnen:

                die aktuelle Zeit

                in welcher Form?

                1 Reply Last reply Reply Quote 0
                • E
                  exmerci last edited by

                  @homoran

                  Das ist mir eigentlich egal. Ich muss nur erreichen, das ich 5 Tage später etwas starten kann. Also ich muss wissen, wann die 5 Tage vorbei sind.
                  Ich hoffe, ich komme verständlich rüber.

                  Homoran 1 Reply Last reply Reply Quote 0
                  • Homoran
                    Homoran Global Moderator Administrators @exmerci last edited by

                    @exmerci sagte in Zeitdifferenz berechnen:

                    ich muss wissen

                    also nur für dich? als Reminder?

                    oder willst du damit weiterarbeiten/rechnen o.ä.

                    E 1 Reply Last reply Reply Quote 0
                    • E
                      exmerci @Homoran last edited by exmerci

                      @homoran

                      Also ich will damit schon weiter arbeiten.
                      Ich möchte die Aktion, wenn 5 Tage vorbei sind starten, also mit "steuere" eine Aktion auslösen.
                      Aber eben nur, wenn schon 5 Tage oder mehr vergangen sind. Sonst nicht.

                      Homoran 1 Reply Last reply Reply Quote 0
                      • Homoran
                        Homoran Global Moderator Administrators @exmerci last edited by

                        @exmerci also willst du nicht

                        @exmerci sagte in Zeitdifferenz berechnen:

                        die aktuelle Zeit in einen Datenpunkt

                        so dass du sie lesen kannst, sondern als Unixtime zum rechnen

                        Screenshot_20250829-203000_Firefox.jpg

                        E 2 Replies Last reply Reply Quote 0
                        • E
                          exmerci @Homoran last edited by

                          @homoran sagte in Zeitdifferenz berechnen:

                          so dass du sie lesen kannst, sondern als Unixtime zum rechnen

                          Ja, wenn das nur so geht, dann ja.
                          Ich muss leider Morgen weiter machen. Muss jetzt erst mal weg. Danke erstmal soweit.

                          1 Reply Last reply Reply Quote 0
                          • E
                            exmerci @Homoran last edited by

                            @homoran

                            Das hat für meine erste Berechnung schonmal super geklappt.
                            Was ich jetzt noch versuchen wollte, ist die Tage auf das aktuelle Datum zur Anzeige zu addieren, aber das hat so einfach nicht geklappt.

                            Bildschirmfoto-9.png

                            Oder geht das nur, wenn ich die Millisekunden wieder in das Datum umrechne? Aber wie geht das dann?

                            Homoran haus-automatisierung 2 Replies Last reply Reply Quote 0
                            • Homoran
                              Homoran Global Moderator Administrators @exmerci last edited by

                              @exmerci sagte in Zeitdifferenz berechnen:

                              wenn ich die Millisekunden wieder in das Datum umrechne

                              du musst zu der aktuellen Zeit als Datumsobjekt + 432000000 addieren um den Timestamp von in 5 Tagen zu erhalten.

                              Den kannst du dan in human readable Format konvertieren
                              oder als CRON in einem Trigger verwenden um die Alarmsirene oder was immer du willst zu starten, wenn dein gewünschter Teitpunkt erreicht ist

                              1 Reply Last reply Reply Quote 1
                              • haus-automatisierung
                                haus-automatisierung Developer Most Active @exmerci last edited by

                                @exmerci sagte in Zeitdifferenz berechnen:

                                Was ich jetzt noch versuchen wollte, ist die Tage auf das aktuelle Datum zur Anzeige zu addieren, aber das hat so einfach nicht geklappt.

                                Basis für die Addition ist die aktuelle Zeit als Datum-Objekt. Danach kannst Du das Format ändern in TT.MM.JJJJ

                                1 Reply Last reply Reply Quote 1
                                • E
                                  exmerci last edited by

                                  @homoran sagte in Zeitdifferenz berechnen:

                                  du musst zu der aktuellen Zeit als Datumsobjekt + 432000000 addieren um den Timestamp von in 5 Tagen zu erhalten.

                                  Ja, das habe ich verstanden und gemacht. Was ich aber zusätzlich möchte ist, das Ergebnis wieder in das Format TT.MM.JJJJ bringen.

                                  @haus-automatisierung

                                  Danach kannst Du das Format ändern in TT.MM.JJJJ

                                  Und das ist, von dem ich nicht weiß wie.

                                  haus-automatisierung 1 Reply Last reply Reply Quote 0
                                  • haus-automatisierung
                                    haus-automatisierung Developer Most Active @exmerci last edited by

                                    @exmerci So wie beschrieben.

                                    Screenshot 2025-08-31 at 14.32.15.png

                                    Oder von mir aus auch in einer Zeile

                                    Screenshot 2025-08-31 at 14.32.56.png

                                    1 Reply Last reply Reply Quote 3
                                    • E
                                      exmerci last edited by

                                      @haus-automatisierung

                                      Klasse, danke.

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post

                                      Support us

                                      ioBroker
                                      Community Adapters
                                      Donate

                                      825
                                      Online

                                      32.0k
                                      Users

                                      80.5k
                                      Topics

                                      1.3m
                                      Posts

                                      blockly
                                      20
                                      106
                                      18967
                                      Loading More Posts
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      Community
                                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                      The ioBroker Community 2014-2023
                                      logo