473,804 Members | 3,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("e mployee_id")) %>">
<input name="office_id " type="hidden" value="<%=
trim(request("o ffice_id")) %>">
<select name="weekbegin " onChange="submi t()">
<%
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("weekbe gin") 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 2096
sd_eds wrote on 03 okt 2007 in microsoft.publi c.inetserver.as p.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("e mployee_id")) %>">
<input name="office_id " type="hidden" value="<%=
trim(request("o ffice_id")) %>">
<select name="weekbegin " onChange="submi t()">
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("weekbe gin") 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
3349
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 after 17 days from startdate of contract. How do I calculate the leave days, that accrue every after 17 days by 1. I'm using ASP and SQL Server 2000 (Query Analyzer) ndindi22
2
1575
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 and month for each SchID/Month combo for which there is not at least one associated AttendanceDate between that SchID's StartDate and EndDate. Table structure: tblSchedules ------------------ SchID StartDate
7
3510
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 anywhere so thought my time first post should be here. With that out the way... I have a website I've built for my day job rotoruaNZ.com/events that I'd like to improve upon. We have numerous events posted on our website that take place around...
4
1947
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 method to sum how many weeks that is. Any suggestions?Where do i start? Cheers!
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.