`now()` has wrong output in android app, correct output in web form

Hello,
as per the suggestions at Beneficiary IDs: Identifying beneficiaries across different forms or different submissions of a form, I followed Creating Unique Serial Numbers in Forms — KoBoToolbox documentation to auto-generated a form ID from two of the input fields and the current date.

This is a simplified version of my form:

When previewing the form in a web browser, everything is ok:

But in the Android App, now() only contains the current date, no hour/minute/second information, and therefore the ID is truncated:

I think this is a bug in the Android app and I would love if someone could suggest a workaround: how can I retrieve the current hour and minute in a calculation in the Android App?

Thank you very much,
Enrico

Alright, I found a workaround: forcing the formatting of now() using format-date-time removes the differences between web and app.

1 Like

Thank you for sharing this workaround with the community!

Note that using format-date-string also could simplify greatly the example at Creating Unique Serial Numbers in Forms — KoBoToolbox documentation

from

substr(today(),0,4),substr(today(),7,5),substr(today(),10,8),substr(now(),13,11),substr(now(),16,14)

to

format-date-string(now(), '%Y%m%d%H%M')

(or similar).

Cheers,
Enrico

2 Likes