3 Replies Latest reply on Oct 27, 2014 6:51 PM by TKnTexas

    Get date as number

    Sketter

      Title

      Get date as number

      Post

      Hi,

      Dumb question - how do you convert or get the number value of a date?

        • 1. Re: Get date as number
          philmodjunk

          The number value, as in the number of days from the date shown to 12/31/0000?

          Simply refer to the field as a number.

          GetAsNumber ( DateField )

          is one way.

          • 2. Re: Get date as number
            Sketter

            My idea was flawed. Thanks for the answer but lets try another way.

            This is my formula.

            Let ([y=MPR::Month];Year(y))  &  Let([zz=MPR::Month];Month ( zz ))
             ≥    
            Let ([x=Get (CurrentDate)];Year(x))  &  Let([w=Get ( CurrentDate )];Month(w))

            Note this script is not run regularly, and now i found a bug.
            If MPR::Month is Feb 2014, it returns 20142. When running the script CurrentDate today returns 201410 making it then lower then MPR::Month.

            So i guess my question is how to i get 20142 to 201402?

            Thanks

            • 3. Re: Get date as number
              TKnTexas

              If I am reading this correctly, you want the date to be yyyymm.  If that is correct, then what you are looking to get is:

              Year ( get(CurrentDate)) & right ("0" & month ( get(CurrentDate)),2)

              The piece you are wanting is the leading ZERO on single digit months.