How to Default Dates to Now

Anne Rosebery
Form Developers

When wanting to default a date, date/time, or time field to now, you can use the following in the default field space for that field:

${new Date().toISOString()}

This will set the date to now using the following format:

YYYY-MM-DDTHH:MM:SS.mmmZ

Example:

2019-10-30T21:29:22.252Z

Note that this is in GMT. The display will update to display in your current timezone for dates and date-time, but since time only pulls the time part of the date, it will display the GMT time.

For example, this date: 2019-10-30T21:29:22.252Z

Will display in CST as

  • Date: 10/30/2019
  • DateTime: 10/30/2019 4:29 PM
  • Time: 8:29 PM