# Problems with now() function

**URL:** <https://forum.getodk.org/t/problems-with-now-function/31760>\
**Category:** Support\
**Tags:** odk-xlsform, odk-collect\
**Created:** [December 23, 2020, 12:09am UTC](https://forum.getodk.org/t/problems-with-now-function/31760 "2020-12-23T00:09:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnsdtr\_github](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/nnsdtr_github/32/14388_2.png) [@nnsdtr\_github](https://forum.getodk.org/u/nnsdtr_github)\
**Post date:** [December 23, 2020, 12:09am UTC](https://forum.getodk.org/t/problems-with-now-function/31760/1 "2020-12-23T00:09:36Z")

</div>

Hello!

I'm currently building a form in which I need to let the enumerator know how much time he has spent for a field sampling. He has two hours to complete his sampling and this is a rule that must be followed.

The form presents a repeating group in which he must write down data about the observation of a specimen in the wild. With each iteration of this repeating group, I would very much like to be able to alert him how much time he has left. However, I have not been able to do this by using the `now() - initial_time` approach, because I have noticed that the `now()` function seems to be static, being evaluated only at the moment the form is opened.

I'm thinking of asking the enumerator to fill in the time every new iteration in the looping, but the ideal scenario is that he wouldn't even have to worry about it.

Could someone tell me if there is any other way to approach the problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [December 23, 2020, 5:38am UTC](https://forum.getodk.org/t/problems-with-now-function/31760/2 "2020-12-23T05:38:14Z")

</div>

You can trigger `now()` when a specific field is changed. See the first example at [https://xlsform.org/en/#trigger](https://xlsform.org/en/#trigger). For example, you can add a field that is set to `now()` when the first question in your specimen observation repeat is set by the data collector.

---

<div class="post-metadata">

**Author:** ![Nitin\_Srivastava](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/nitin_srivastava/32/9739_2.png) [@Nitin\_Srivastava](https://forum.getodk.org/u/Nitin_Srivastava)\
**Post date:** [December 27, 2020, 10:50am UTC](https://forum.getodk.org/t/problems-with-now-function/31760/3 "2020-12-27T10:50:01Z")

</div>

Thanks. This solution works.
