2 Replies Latest reply on Sep 6, 2010 12:21 PM by Æthernaut

    How to "build" a payday timestamp



      How to "build" a payday timestamp



      I have a record consisting of two entry fields, dat.e and tim.e, and a calculation field in which I would like to "build" a timestamp so that I can do comparative calculations with other, unaltered timestamps. The built stamp, tmstmp.startin, should have the following modifications:

      1) It will be shifted backwards from the dat.e entry to the first day of its pay period. (Don't know if there's a function for that, yet).

      2) The time will be rounded down to the nearest quarter-hour increment of the corresponding tim.e entry, as in =Time(Hour(tim.e),Int((Minute(tim.e))/15)*15,0)

      Things are muddied when I try to combine both into tmstmp.startin. Is there a way for a field to be both a Timestamp and a Calculation field?  How would you approach this?

        • 1. Re: How to "build" a payday timestamp

          1. We don't know how you figure its 1st day of pay period. It can almost certainly be done, some way.

          2. What you wrote works, if you use the correct separator (;) and the Timestamp() function (and remove the extra ")")
          I added the Let() to make it more readable (which I like to do).

          Let (
          t = Time ( Hour (Time_end); Int (( Minute (Time_end)/15 )) *15; 0);
          Timestamp ( Date_end; t )

          P.S. This is the 2nd time I tried to post this answer. The forum software is sometimes throwing me to a new (non-functional) page when I edit HTML, and the Back command did not work. I wish they'd fix this clunky Windows-derived forum; it's been a while. 

          • 2. Re: How to "build" a payday timestamp

            Ok, I see how the Timestamp can clear up the merger query. Thanks.

            Now, if I can find a chunk of code for calculating paydays, then  I'll be set.  I suspect one needs to know a seed date, say 8/16/2010, and then be able to find the closest Sunday that is a multiple of two weeks (60*60*24*7=604,800 minutes).