For each loop time stamp manipulation

Options
I use function 'for each loop' that add records based on the array. I need to set the "date_from" variable for each new record starting from the input date and adding +2 days to each next record.

Is there a way to create a record with date and time manipulations?
[Снимок экрана 2022-06-03 в 11.24.49.png][Снимок экрана 2022-06-03 в 11.26.14.png]

Comments

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options
    Hi, George! You can add a filter to your Add Record, in this example I'm using add_secs_to_timestamp to add two days (in seconds).
    [image.png]
  • George
    George Member
    Options
     thank you for your reply. I have tried this filter. This filter add 2 days for each record and result is the same date.
    I need to increase the date by 2 days in each next entry. 
    For example: input date - jun 3, 2nd record - June 5, 3rd record - June 7 and so on for each object of array.
  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options
     Ah, I see! In that case, you could store the number of seconds to add in a variable, and instruct your loop to increase the count using a Math function, perhaps?
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - Xano can also take in relative time formats to transform your timestamp. For example, apply the transform_timestamp filter and the value would just be +2 days

    Our documentation has a link to all the combinations of relative time that you can use.

    https://docs.xano.com/working-with-data/timestamp
    [Screenshot_2022-06-03_16-42-37.png]
  • George
    George Member
    Options
    I found a solution. not sure it's elegant.
    I had to subtract 2 days when creating the variable at step 2 because when the user input a date, the first record goes +2 days immediately
    [Снимок экрана 2022-06-03 в 20.30.21.png]