bigtwig
asked on
Displaying/Storing Today's Date in ASP/SQL Server
SQL Server and ASP. pecADActDate is mapped as smalldatetime on SQL. I have a form and want to set that variable to today. I'd like it to display the date MM/DD/YY or MM-DD-YYYY (something very USAish) when the form opens but still store it (and allow changes) as smalldatetime. Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you could also do this on the form field
formatdatetime(theVariable ,2)
formatdatetime(theVariable
SQL Server has the GETDATE() function to get the date for Today, so I don't know why you are talking about Javascript.
Bob
Bob
ASKER
OK, I need to back up.
I have a form with a variable, ADActDate, that I want to set to Today's Date when the form loads. It should display in the form and be editable. This is the cell that I have:
<td><input TYPE="Text" Name="ADActDate" SIZE="20" MAXLENGTH="20" value="<%=ADActDate%>"></t d>
How do I set ADActDate to today when the form loads and display MM/DD/YYYY.
If I do this, am I all set when I do my SQL Update?
If IsDate(Request.QueryString ("ADActDat e")) Then
ADActDate = CDate(Request.QueryString( "ADActDate "))
Else
ADActDate = Date
End If
Thanks.
I have a form with a variable, ADActDate, that I want to set to Today's Date when the form loads. It should display in the form and be editable. This is the cell that I have:
<td><input TYPE="Text" Name="ADActDate" SIZE="20" MAXLENGTH="20" value="<%=ADActDate%>"></t
How do I set ADActDate to today when the form loads and display MM/DD/YYYY.
If I do this, am I all set when I do my SQL Update?
If IsDate(Request.QueryString
ADActDate = CDate(Request.QueryString(
Else
ADActDate = Date
End If
Thanks.
SQL Server can handle dates in MM/DD/YYYY format, so you wouldn't need to do anything else.
Bob
Bob
ASKER
I used this:
http://www.irt.org/script/1635.htm
http://www.irt.org/script/1635.htm
SELECT CONVERT(varchar(10),getdat e(),101)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER