Re: Inserting Dates in Insert Form automatically

March 4, 2003 by Joshua Yes

You can use a hidden field. Put something like this in the value:
<%= Date() %>
or
<%= Day(Now) %>-<%= Month(Now) %>-<%= Year(Now) %>

Remember that this is the client date from the machine. Instead of using this client date (it can be set wrong by the client) use the server date.

So, you can also use Access to insert automaticly a date, the server date. Set the 'Date/Time' type of the field. Put in the 'Standardvalue':
Date()
and set the 'Notation' to for example 'Standard-datenotation'

 

RE: Inserting Dates in Insert Form automatically

March 12, 2003 by Jeremy Neal

The easiest route to follow would be to bypass coding at all and operate directly in Access. In your table, simply set the default value of your date field to "new Date()" (without the quotes), then whenever a new record is added to the table the date will be filled automatically.

The second problem is a bit more complex, using JScript you could try the following:

<%
var months="new" Array("January", "February", "March" ...etc.);
var d = new Date(((new Date()).getTime())-604800000);
var dstring = d.getDate()+" "+months[d.getMonth()]+" "+d.getFullYear();
var sqlstring = "DELETE * FROM [tablename] WHERE [datefield] < " + dstring + "";
%>

Finally, replace the SQL source in your Dreamweaver delete function with sqlstring.
If you're into VBScript then I can't really help. Because it's pants. ;)

RE: Re: Inserting Dates in Insert Form automatically

January 28, 2004 by yasser ibraheem

i want to use calender for date selection in vbscript code