How to Default Date Fields to "Now"
When wanting to default a date, date/time, or time field to now, you can use the following code 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
For example, the following date is displayed in GMT: 2019-10-30T21:29:22.252Z.
The display will update to display in your current timezone for dates and date/time fields, but since time only pulls the time part of the date, it will display the GMT time.
For example, a date of 2019-10-30T21:29:22.252Z will display in Central Standard Time like so:
- Date: 10/30/2019
- DateTime: 10/30/2019 4:29 PM
- Time: 8:29 PM
Updated almost 2 years ago