There are different ways to include the current date in a newly inserted record. This TechNote describes two options:
One approach to this task is to setup a hidden field (Insert> Form > Hidden Field). Once the hidden field has been added, select the yellow icon that represents the hidden field and go to the Property inspector. In the Value field, enter the appropriate code for the date function:
- ASP: <%= Date() %>
- JSP: <%= new java.util.Date() %>
- ColdFusion: #Now()#
If you want to give the end user the option to change the date to something other than today's date, then use a regular text field instead of a hidden field.
When filling out the Insert Record server behavior dialog box, map the hidden form field to the date field in the database and set the data type to either "Date" or "MS Access Date".
Note: The date being inserted will be the date on the application server. Keep this in mind if users are in different time zones.
Another approach to this task is to set the default value of the database's date field to the current system date. Most, if not all, databases will have a "default value" option for database fields. One advantage to using this approach is that you do not have to worry about the date format being sent from the web page. Here is how to set the default value to today's date in Microsoft Access 2000:
Please refer to the Microsoft Access documentation for further detail on setting default values. If you are not using Access, please refer to your database documentation for instructions on how to set the default date value.
Note: The date being inserted will be the date on the database server. Keep this in mind if users are in different time zones.
For more information on how to use the Insert Record server behavior, please see Building an insert record page block by block.