The Date/Time field type is used to capture temporal data. 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 information on each individual property in the Form designer itself. Click on the '?' icons 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.
Note: Be mindful of the timezone implications of these 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
Through the app and platform, our system automatically displays all Date/Time values according to the user's timezone. Users should see the Date/Time values adjusted to their timezone in the Data area of the secure website. The platform will take care of displaying the answer values in the appropriate timezone. There is an option in Organization Setup to let you specify a user-specific timezone for 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 - i.e. Dynamic Value, Visibility, Data Source binding - you should be mindful of the above timezone implications for the fields 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.