Announcement

Collapse
No announcement yet.

not calculate weekends

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • not calculate weekends

    Hello

    How to add to this code of did not calculate weekends

    ic = datetime\diff(datetime\now(), availability, 'days')


  • #2
    I think that you could use the working time calendar for this. Take a look:

    Comment


    • #3
      It does not work

      Comment


      • yuri
        yuri commented
        Editing a comment
        What does not work. Why we need to guess.

    • #4
      The settings are good, but it calculates the days week-end

      Comment


      • #5
        Your formula from the first post it not supposed to take into account working calendar. You need to use other functions from the article.

        Comment


        • #6
          Can you give me a correct formula?

          Comment


          • #7
            Code:
            $numberOfDays = availability; // this just for readability
            
            ic = ext\workingTime\addWorkingDays(datetime\now(), $numberOfDays);
            Note that the working time calendar should be applied to the system (Administration > Settings > Working Time Calendar).

            Comment


            • #8
              $numberOfDays not recognized in entity formula

              Comment


              • rabii
                rabii commented
                Editing a comment
                what do you mean ? $numberOfdays is just a variable that holds the value of your field. make sure that you have the correct field name.

              • abidoss
                abidoss commented
                Editing a comment
                ic = datetime\diff(datetime\now(), disponibilit,'days') it works but it calculates over 7 days

                $numberOfDays = disponibilit ; // ceci juste pour la lisibilité
                ic = ext\workingTime\addWorkingDays(datetime\now(), $numberOfDays); it doesn't work it no longer calculates

            • #9

              Comment


              • #10
                Just remove the line //this is for readibility
                try this instead
                Code:
                $numberOfDays = disponibilit;
                ic = ext\workingTime\addWorkingDays(datetime\now(), $numberOfDays);
                as yuri mentioned (Note that the working time calendar should be applied to the system (Administration > Settings > Working Time Calendar).)​

                Comment


                • #11
                  Thanks

                  Comment

                  Working...
                  X