473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Startdate - Enddate dropdown not working ASP, IIS6

I have a startdate-enddate dropdown in asp that works great on my
development machine (XP Pro IIS5) but when I port it over to the web
server (Win Server 2003, IIS6), I do not get the desired results. What
should happen is that the start-end range should show the current
week. Instead, the start-end range defaults to 2 months earlier, when
the page was deployed.

I have added some code below:

<% dim begindate, enddate, startdate %>
<form method="post">
<input name="employee_id" type="hidden" value="<%=
trim(request("employee_id")) %>">
<input name="office_id" type="hidden" value="<%=
trim(request("office_id")) %>">
<select name="weekbegin" onChange="submit()">
<%
startdate = formatDateTime(dateAdd("d", 2 - weekday(now), now),
vbShortDate)
for x = 0 to 365 step 7
begindate = formatDateTime(dateAdd("d", 2 - weekday(now) + x, now),
vbShortDate)
enddate = dateAdd("d", 6, begindate)

if begindate = request("weekbegin") then
%>
<option value="<%= begindate %>" selected><%= begindate & " to " &
enddate %></option>
<%
else
%>
<option value="<%= begindate %>"><%= begindate & " to " & enddate %></
option>
<%
end if
next
%>
</select>
</form>

Any help or insight would be appreciated.

Thanks

Oct 3 '07 #1
2 2081
sd_eds wrote on 03 okt 2007 in microsoft.public.inetserver.asp.general:
I have a startdate-enddate dropdown in asp that works great on my
development machine (XP Pro IIS5) but when I port it over to the web
server (Win Server 2003, IIS6), I do not get the desired results. What
should happen is that the start-end range should show the current
week. Instead, the start-end range defaults to 2 months earlier, when
the page was deployed.

I have added some code below:

<% dim begindate, enddate, startdate %>
Not necessary, unless you use
Option Explicit
first
<form method="post">
<input name="employee_id" type="hidden" value="<%=
trim(request("employee_id")) %>">
<input name="office_id" type="hidden" value="<%=
trim(request("office_id")) %>">
<select name="weekbegin" onChange="submit()">
submit() needs a form object:

onChange="this.form.submit()"
<%
startdate = formatDateTime(dateAdd("d", 2 - weekday(now), now),
vbShortDate)
the weekday() 0 day is system dependent!

use:

Weekday(now, 1)

for x = 0 to 365 step 7
begindate = formatDateTime(dateAdd("d", 2 - weekday(now) + x, now),
vbShortDate)
for x = 2 - weekday(now) to 2 - weekday(now) + 365 step 7
theBegindate = dateAdd("d", x, now)
[see below]
enddate = dateAdd("d", 6, begindate)
You are not dateAdd to a date variable, but to a date string!!!

The date string is system dependent!

try this:

theStartdate = dateAdd("d", 2 - weekday(now), now)
startdate = formatDateTime(theStartdate ,2)

vbShortDate is not defined in vbscript, use number 2

theBegindate = dateAdd("d", 2 - weekday(now) + x, now)
begindate = formatDateTime(theBegindate ,2)

theEnddate = dateAdd("d", 6, theBegindate )
enddate = formatDateTime(theEnddate ,2)
if begindate = request("weekbegin") then
Never use a general request, do a safer request.form()

%>
<option value="<%= begindate %>" selected><%= begindate & " to " &
enddate %></option>
<%
else
%>
<option value="<%= begindate %>"><%= begindate & " to " & enddate %></
option>
<%
end if
next
%>
</select>
</form>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 3 '07 #2
Thanks for the help.

Oct 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ndindi22 | last post by:
Can someone plz help me. I'm working on leave application, have to calculate number of leave days available, starting from Startdate to Enddate of a contract. Where an employee get 1 day leave...
2
by: HoganGroup | last post by:
Hi fellows: I am at a complete lost as to how to construct a query or report to answer this question. Any help is greatly appreciated. The question I need to answer is this: Identify the SchID...
7
hodgeman
by: hodgeman | last post by:
Hello thescripts forums users... I've found a lot of answers to problems I've had in the past from this forum, and this is the first mySQL query issue I haven't been able to find an answer from...
4
by: nologo | last post by:
all, I have a startdate and enddate, i wish to be able to calculate how many weeks have been selected. so for example, using the startdate and enddate, i select 11/02/2008 and 25/02/2008 i need a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.