For each loop time stamp manipulation
Options
George
Member ✭
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]
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
-
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] -
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. -
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?
-
- 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] -
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]
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback