2 Replies Latest reply on Aug 21, 2013 8:55 AM by Matty_1

    HUH?  Simple math isn't working.

    Matty_1

      Title

      HUH?  Simple math isn't working.

      Post

           Hello,

           I have the following calculation:

            

           
                Filter ( TimeFormatAs ( RightWords ( Get ( CurrentTimeStamp ) ; 2 ) ; 24 ) ; "0123456789" )  ≥  80000
           
                 
           
                and
           
                 
           
                Filter ( TimeFormatAs ( RightWords ( Get ( CurrentTimeStamp ) ; 2 ) ; 24 ) ; "0123456789" )  ≤  190000

           I have installed a timed script running hourly backups and I only want it to run during business hours otherwise I will have a boat load of backups for nothing.  My issue is that the above calculation only functions after 10 AM.  My TimeFormatAs is a custom function that outputs a 24 hour clock and obviously the filter removes all spaces and whatever else to produce a proper integer, so 09:45:00 AM comes out as 94500.  I get the impression that because the output isn't six digits long the second line can't resolve but I don't know why.  Once the output is at 100000 or more the files start to backup.

           Any ideas?  Thanks!

        • 1. Re: HUH?  Simple math isn't working.
          philmodjunk

               That looks like anything but "simple math" to me.wink

               I can think of a much simpler expression.

               Time and TimeStamp fields internally store the value as an integer that represents a value in seconds.

               Time fields store the number of seconds since midnight and TimeStamp fields measure the elapsed seconds since Midnight of 12/31/0000.

               Thus, you can use this expression to check to see if the time is between 8:00 AM and 7:00 pm (19:00 hours).

               Let ( T = Get ( CurrentTime ) ; T > ( 8 * 3600 ) and T < (19 * 3600 ) )

               I put in the multiplication to show how the math works. You can use this expression to get the same results:

               Let ( T = Get ( CurrentTime ) ; T > 2880  and T < 6840 )

          • 2. Re: HUH?  Simple math isn't working.
            Matty_1

                 haha fair enough, much simpler indeed.  Thank you Phil!