database date

D

debbie

I used the DRW to create my web. When a use adds a record
I want the date that record was added to be displayed. Is
there a way to do this without having the user input the
date?
 
M

MD WebsUnlimited.com

Hi Debbie,

If you have MS Access to create the database you can define a field that is
automatically set to the current date and time. If not, then you'll need to
use a text field, normally hidden, that has been set to the current date.

To set the field use JavaScript like so:
<form method="POST" action="--WEBBOT-SELF--" name="FrontPage_Form1">
<!--webbot bot="SaveResults"
U-File="http://www.fpplus.com/samples/_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="hidden" name="Date" size="20" ><input type="submit"
value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

<script>
var oDate = new Date();
document.FrontPage_Form1.Date.value = oDate.toDateString();
</script>
 
J

Jon Spivey

Hi Debbie,
assuming you're using Access? If so open your database in Access click your
field and set its default value to date() for just the date or now() for
date + time. If you're using sql server you'd use getdate() instead - which
enters date + time (you can't have just date in sql server)
 
Top