Changing date FORMAT (month to number)

What is the problem? Please be detailed.
I am using tab3 and due to the outdated version I was not able to use other function. So, it possible to change (Jan, Feb,Mar)months into (1-12) number rather that word???
What ODK tool and version are you using? And on what device and operating system version?
(Galaxy Tab 3V) (ODK Collect v1.12.2)

What steps can we take to reproduce the problem?
I tried to use another platform but not tested all, i tried (odk collect). So, is it possible to convert date in such format (dd,mm,yyyy)??
What you have you tried to fix the problem?
Just used the few other platform but didnt work
Anything else we should know or have? If you have a test form or screenshots or logs, attach here.
Just I dont have idea about it.

You can accomplish this either using a long, messy if(...) calculation, eg

num: calculate = "if(${month}='Jan', 1, if(${month}='Feb', 2, ...))"

Or arguably a more 'elegant' solution is to use a jr:choice-name() lookup table to map your month name to a number; specifically, adding a hidden select_one question to your form(!). Try this:

monthnum.xls (5.5 KB)

(using a hidden select_one choice list as a lookup table can be a pretty useful XForms trick... :wink: )

1 Like