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

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,

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




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

(or similar).