Discussions

Expand all | Collapse all

How do I create a formula that moves the date/time 7 days ahead?

  • 1.  How do I create a formula that moves the date/time 7 days ahead?

    Bronze
    Contributor
    Posted 10-27-2016 05:06

    Kirk Trachy helped me with this formula today, but one part I left out is that the the date field was actually a date/time field, so I also need the exact time to be represented one week into the future (fid 13):

    var text url =

        URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &

        "&rid=" & [Record ID#] &  "&apptoken=vsiemiczqajhgb9m982fds3fgt4" &

        "&_fid_23="&[Next Sale Date] &

        "&_fid_13="&WorkdayAdd(ToWorkDate(Today()),7)&

        "&_fid_14=0"&

        "&_fid_16=0"&

        "&_fid_17=0";

    "javascript:" & "$.get('" & $url & "', function(){" & "location.reload();" &

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545}

        "});" & "void(0);"



  • 2.  RE: How do I create a formula that moves the date/time 7 days ahead?

    Top
    Contributor
    Posted 03-17-2017 04:31
    Because you are dealing with a date time, and QuickBase doesn't have an "AdjustWeek" formula.  You can add the number of hours in a week.

    24 hours x 7 days = 168 hours.  
    And you can use the "Now()" option to use the current date / time. 
    Combine that to be 

    "Now()+Hours(168)"
    So you can change you fid_13 line to be 

    "&_fid_13="&(Now()+Hours(168))&