fksolutions
asked on
ASP date from db - 2 months
I am a beginner at ASP, I need help with a date function.
I am working with an old ASP VB script.
I have a date in DB.
<%=rs("start")%> (my date in db for example: 2012-09-01)
Fisr question:
How do I write a date 2 months back? - 2012-07-01
And second question:
How do I write same as question one but instead of full date just show 07 or Juli(month name).
I am working with an old ASP VB script.
I have a date in DB.
<%=rs("start")%> (my date in db for example: 2012-09-01)
Fisr question:
How do I write a date 2 months back? - 2012-07-01
And second question:
How do I write same as question one but instead of full date just show 07 or Juli(month name).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is your recordset really called, rs2("start") otherwise it will be counted as a function. You can use rs2.Fields.Item("start").V alue to be sure.
You need to make sure your recordset is created in your include file or before the code where you insert the include file on the main page.
You need to make sure your recordset is created in your include file or before the code where you insert the include file on the main page.
You missed that DateAdd returns a value, so use it like this
<%
startdaterorligt = rs2("start")
SomeThing = DateAdd("m", -2, startdaterorligt)
%>
GH
ASKER
Open in new window
gets error
Microsoft VBScript compilation error '800a0414'
Cannot use parentheses when calling a Sub
/include/johan201208.asp, line 538
dateadd("m", -2, startdaterorligt)