[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

800a01a8 Error - Object required: 'Date'

Posted on 2004-10-05
4
Medium Priority
?
698 Views
Last Modified: 2008-01-09
I am getting an error in my code when I try to get the current date. I am getting this error:

Microsoft VBScript runtime error '800a01a8'

Object required: 'Date'

/Calendar/Calendar.asp, line 3

When I try to run this code:

<%@LANGUAGE="VBSCRIPT"%>
<%
Set curDate = Date
If Request.QueryString("month") <> "" Then
Set curMonth = Request.QueryString("month")
Else
Set curMonth = Month(curDate)
End If
If Request.QueryString("year") <> "" Then
Set curYear = Request.QueryString("year")
Else
Set curYear = Year(Date)
End If
Set firstDayofMonth = WeekDay(DateSerial(curYear, curMonth, 1))
Set firstDayofMonthName = WeekDayName(WeekDay(DateSerial(Year(curDate), Month(curDate), 1)))
Set curMonthName = MonthName(curMonth)
If curMonth >= 12 Then
Set nxtMonth = 1
Else
Set nxtMonth = curMonth + 1
End If
Set nxtMonthName = MonthName(curMonth + 1)
Set nxtYear = curYear + 1
Set lstDaylstMonth = Day(DateSerial(curYear, curMonth, 1-1))
Set lstDaylstMonthName = WeekDayName(WeekDay(lstDaylstMonth))
If curMonth <= 1 Then
Set prvMonth = 12
Else
Set prvMonth = curMonth - 1
End If
Set prvMonthName = MonthName(prvMonth)
Set prvYear = curYear - 1

Select Case curMonth
Case 1,3,5,7,8,10,12
Set numDays = 31
Case 2
If curYear/4 = int(curYear/4) Then
Set numDays = 29
Else
Set numDays = 28
End If
End Select
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><%=curMonth%> - <%=curYear%></title>

I have tested the date function on another page and it has worked fine.

here is what has worked for me so far: (every part of it has worked on this page)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
Month: <%=Month(Date)%><br>
Year: <%=Year(Date)%><br>
Day: <%=Day(Date)%><br>
MonthName(Month): <%=MonthName(Month(Date))%><br>
First Day of Month: <%=WeekDayName(WeekDay(DateSerial(Year(Date), Month(Date), 1)))%><br>
Last Day of Last Month: <%=Day(DateSerial(Year(Date), Month(Date), 1-1))%><br>
Last Day Name of Last Month: <%=WeekDayName(WeekDay(DateSerial(Year(Date), Month(Date), 1-1)))%><br>
Date: <%=Date%>
</body>
</html>

If there is some stupid thing i am doing then I wouldn't be suprized, because i am new to the asp programing language.

Thank you for your help.
0
Comment
Question by:chadreeves1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 12

Accepted Solution

by:
kingsfan76 earned 500 total points
ID: 12232347
>>Set curDate = Date

change it to:

curDate = Date
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 12232359
"Set" is for use with object i believe (like Set rst=server.CreateObject("adodb.recordset"))
"Date" is a function, so you can't use "Set" with "Date"
Just use regular assignment statement and it should be fine.
0
 
LVL 1

Author Comment

by:chadreeves1
ID: 12232369
I knew it was something stupid. I had to remove the "Set" from all of my variables
0
 
LVL 12

Expert Comment

by:kingsfan76
ID: 12232373
p.s. you need to remove all the "Set" in your assignment statements:

example:
Set curMonth = Request.QueryString("month")
Set numDays = 28
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question