Update variable past midnight daily
Options
![Coco Wang](https://us.v-cdn.net/6037124/user_avatars/3461844.jpg)
Coco Wang
Member ✭
Hi all - I'm hoping to update a variable right past midnight to a default value daily. I looked into timestamp data manipulation but wasn't able to find a solution. Appreciate any pointers! Cheers.
Comments
-
Can you give an example of an input value, and what output value you are looking for in that situation? Like, is it just you want to update field X on table Y to a value of 0 each day? Or is there something more involved?
The timing part is straightforward - Xano has a scheduled "background task" feature that you can set the time of day for it to run whatever set of functions. So the question is _what_ you want to have happen in that "stack" -
Thanks for the info!
Yes, I'm trying to update a field on table Y to a value of 10 each day. Can background task update the value past midnight based on the user's timezone? Or is this something I should implement in the frontend? -
I could imagine a background task that runs every half hour and checks for users whose time zone offset and date makes the current time “midnight”. (Half hour because some time zones like IST are not on the hour from Greenwich mean time). For those people, reset the value. As long as you have the time zone in a user table that could work!
-
Hey guys, I have the same problem with the fact that I need to reset some values in the database once a day.
If I set the condition
now(format: userTimezone) === now(format: midnight)
this condition will succeed only if 00:00:00 === 00:00:00, but what if the function I am executing is more complex?
My function might hit this check at 00:01:00.
I hope you understand the question.
This bellow is an idea like if in 5 minutes (this is enough for the function to execute) then…do needed resets.
I'm super tired after some superfluous logic so any idea is more than welcome. ❤️
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