how to insert date and time into your database (basics)
to insert new records or to update existing records you have to set up a form and apply an "Update Records" or "Insert Records" behaviour. in the dialogbox you can define which form field inserts/updates which column in your database. while in most cases the information that should be inserted consists of text or selections that the users make, you might often want to ad a field that inserts the time and date of the entry automatically. you can do this by using e.g. another hidden field and make the value dynamic like the following: <input type="hidden" name="insertDate" value="<%= FormatDateTime(Date) %>" > this is a VBScript example. you find a list of the different ways to format date and time at http://www.activeserverpages.com there are various ways of formatting date and time with JavaScript. please be aware that if you use ASP to dynamically change the value it will always return the SERVER TIME, which might be several hours different to the user's local time and with this sample the value will be created when the page is opened, not when the form is submitted. to enter the current local time of the user you would have to use e.g. clientside JavaScript to perform the task. |