9 Replies Latest reply: Jul 19, 2012 12:58 PM by DKinsley RSS

    Increase by one calendar day

    DKinsley Community Member

      The user enters a Monday date in a date/time object. It is, and needs to be displayed in full (Monday, July 16, 2012) When the user then clicks a check box object, the remaining days of that week are populated into four other date.time objects. I was trying to use the following FormCalc to verify the user selected a "Monday" date and if yes, then add one day for each other field but it does not work.

       

      Here's an example form section -

       

      // Get the number of days since epoch (Jan 1, 1900).

      var dateNum = Date2Num(Day1.formattedValue,"M/D/YYYY")

      // Convert the number of days to the full weekday name.

      MondayCheck.rawValue = Num2Date(dateNum,"EEEE")

      if (MondayCheck.rawValue ne "Monday") then

      xfa.host.messageBox("First Requested Day Must Be a Monday.");

      $.rawValue = "";

      endif

       

      DayTwo.Day2.rawValue = Num2Date(Date2num(Day1.rawValue,"YYYY-MM-DD")+1,"EEEE, MMMM D, YYYY");

      DayThree.Day3.rawValue = Num2Date(Date2num(Day1.rawValue,"YYYY-MM-DD")+1,"EEEE, MMMM D, YYYY");

      DayFour.Day4.rawValue = Num2Date(Date2num(Day1.rawValue,"YYYY-MM-DD")+1,"EEEE, MMMM D, YYYY");

      DayFive.Day5.rawValue = Num2Date(Date2num(Day1.rawValue,"YYYY-MM-DD")+1,"EEEE, MMMM D, YYYY");