Date between day 1 and day 2: Example

Domotica gratuit Forums How can I …? Exemples Blocky Date between day 1 and day 2: Example

Ce sujet a 0 réponse, 1 participant et a été mis à jour par Avatar djandib, il y a 2 ans et 7 mois.

Affichage de 1 message (sur 1 au total)
  • Auteur
    Messages
  • #4195
    Avatar
    djandib
    Participant

    Problem:
    Maybe you need to define a timeperiod for using it in other scenes.
    For TIME between you can use the Blocky. But there isn`t a blocky for DATE between.

    Solution
    We work with 3 variables and a free PHP-Blocky (you find it in the “Util” folder inside Blocky)
    We need:
    – Startdate
    – Enddate
    – summer (name of the variable

    phpcode for PHP-Blocky:
    ****
    $startTime = strtotime($startdate); $endTime = strtotime($enddate);
    $startFormat = date(‘Y-m-d’,$startTime); $endFormat=date(‘Y-m-d’, $endTime);
    if(date(‘Y-m-d’) >= $startFormat && date(‘Y-m-d’) <= $endFormat){
    $sommer=true;
    }else{
    $sommer=false;
    }
    ****

    After this we can use the variable for making request at it:

    Scene Summer

    Andi

Affichage de 1 message (sur 1 au total)

Vous devez être connecté pour répondre à ce sujet.