When needing to capture temporal data, use our Date/Time field.
As the name implies, this Form field allows you to collect dates, times and date + time values.
As with most of our Form fields, the Date/Time field type has a set of common properties that you can configure to control the field’s behaviour and look.
We provide a lot of information on each individual property in the Form designer itself – just click the little “?” buttons to see detailed hints.
Below we have highlighted some of the key aspects of the Date/Time field type.
This allows you to specify whether the field should capture dates only, times only or a combination date & time value.
The choice is simple enough – just consider what value you need for your scenario.
However you should be mindful of the timezone implications of this options.
Date and time values are easy to think about, but become tricky when you have users working in multiple timezones.
Depending on the option you choose, our platform will store values in either local device timezone or UTC/GMT timezone:
- Date Only stores values in local device timezone
- Time Only stores values in local device timezone
- Date & Time stores values in UTC timezone
On the app and platform side, our system automatically displays all Date & Time values according to the logged in user’s timezone.
So users should see the Date & Time values adjusted for their timezone in the Data area of the secure website.
As such you don’t need to worry too much about which option you choose, since the platform will take care of displaying the answer values in the appropriate timezone. We also provide an option in the Organization Setup page which lets you specify that the user-specific timezone be used when working with Date & Time values in template generation and general data export cases.
Working with Date & Time values in formula and bound Data Source scenarios
When working with Date/Time field answers in formula scenarios – e.g. Dynamic Value, Visibility, Data Source binding – you should be mindful of the above timezone implications of your Date/Time Type decision for the field in question.
You can convert date & time values between local and UTC timezones using the DATETOLOCAL() and DATETOUTC() formula functions.
If you are inserting/updating rows in a Data Source with Date & Time values from a Form (see our “Bind to Data Source” Form Recipe on how to do this), then you will see that the values in the bound Data Source column are in UTC timezone.
This is consistent with our platform policy of storing Date & Time values as UTC timezone, and ensures your Data Source will work correctly when bound to Date & Time fields.
How to get Date & Time values stored in your local timezone
If you want to have a Form which needs to capture a date & time value in your local timezone, then you should either:
- Use separate Date only and Time only fields instead of one Date & Time field.
Remember with Date/Time only fields, we store the values in device local timezone.
You can always then combine these values as desired when utilising these answers in templates or connectors.
- Use a single Date & Time field, but also add a Hidden field that stores the local date & time equivalent value.
This is done by using the DATETOLOCAL() formula function in the Hidden field’s Dynamic Value property.
Remember that Hidden fields store values in textual format, so if you want to use this Hidden field in a date formula – e.g. DATEDIFF() – then you need to convert the Hidden field back into a Date & Time value via the DATE() formula function.