I am trying to develop some code that basically limits which days of the
current week you can view in a list/menu based on the current day. So if I
it Tuesday I'll only see Tuesday,Monday,Sunday dates...
I cannot get the dates to display on the asp page...and would also like to
have the date formatted in the vbLongDate but I am not sure where to insert
the code for that.
I have pasted the code in below and any help would be appreciated
Thanks
Steve
<------Code------>
<select size="1" name="StevesDate" style="font-size: 8pt">
<%
x = 0 'initialize the variable
do while not datePart("w", now()- x) = 7 ' set up the loop and tell the
loop when to stop
%>
<option <%=datePart("w", now()- x)%> value="1"><%=(date()- x)%></option>
<%
x = x + 1
if x > 8 then exit do 'oops. Something is wrong so make sure we exit
loop
%>
</select>
This is a sample, if u intended to show just the days in the current week
from sunday to the current day.
-Deepa
"Steve" <Ste...@popmail.com> wrote in message
news:ugi38bH6BHA.1204@tkmsftngp05...
I inserted your code into my page...but still cannot get anything to
display...I have pasted the whole page here could you take a look at if for
me and see where I am going wrong. The date format I am looking for is
Saturday April 20, 2002
Thanks
Steve
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/NetSys.asp" -->
<%
Dim rs1__username
rs1__username = "%"
if (Session("MM_username") <> "") then rs1__username =
Session("MM_username")
%>
<%
set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.ActiveConnection = MM_NetSys_STRING
rs1.Source = "SELECT DISTINCT User FROM weblogin WHERE CompanyEmailName =
'" + Replace(rs1__username, "'", "''") + "' ORDER BY User"
rs1.CursorType = 0
rs1.CursorLocation = 2
rs1.LockType = 3
rs1.Open()
rs1_numRows = 0
%>
<%
Dim rs2__var_jobnum
rs2__var_jobnum = "%"
if (request.querystring("var_jobnum") <> "") then rs2__var_jobnum =
request.querystring("var_jobnum")
%>
<%
set rs2 = Server.CreateObject("ADODB.Recordset")
rs2.ActiveConnection = MM_NetSys_STRING
rs2.Source = "SELECT * FROM timejobselection WHERE JobComplete = 0 AND
JobNumber = '" + Replace(rs2__var_jobnum, "'", "''") + "' ORDER BY
JobNumber, CompanyName"
rs2.CursorType = 0
rs2.CursorLocation = 2
rs2.LockType = 3
rs2.Open()
rs2_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="/css/InfoDeli.css" type="text/css">
<script language="JavaScript">
function doClock(){ // By Paul Davis - www.kaosweaver.com
var t=new Date(),a=doClock.arguments,str="",i,a1,lang="1";
var month=new Array('January','Jan', 'February','Feb', 'March','Mar',
'April','Apr', 'May','May', 'June','Jun', 'July','Jul', 'August','Aug',
'September','Sep', 'October','Oct', 'November','Nov', 'December','Dec');
var tday= new Array('Sunday','Sun','Monday','Mon', 'Tuesday','Tue',
'Wednesday','Wed','Thursday','Thr','Friday','Fri','Saturday','Sat');
for(i=0;i<a.length;i++) {a1=a[i].charAt(1);switch (a[i].charAt(0)) {
case "M":if ((Number(a1)==3) && ((t.getMonth()+1)<10)) str+="0";
str+=(Number(a1)>1)?t.getMonth()+1:month[t.getMonth()*2+Number(a1)];break;
case "D": if ((Number(a1)==1) && (t.getDate()<10))
str+="0";str+=t.getDate();break;
case "Y":
str+=(a1=='0')?t.getFullYear():t.getFullYear().toString().substring(2);break
;
case "W":str+=tday[t.getDay()*2+Number(a1)];break; default:
str+=unescape(a[i]);}}return str;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000"><table width="100%" border="0"
cellspacing="0" cellpadding="1">
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="1%"> </td>
<td colspan="3" bgcolor="#6699FF" align="center" valign="middle"
class="RegCopyBold">Time
Entry Form</td>
<td width="1%"> </td>
</tr>
<tr>
<td width="1%"> </td>
<td colspan="2" class="RegCopy"> </td>
<td width="33%"> </td>
<td width="1%"> </td>
</tr>
<tr>
<td width="1%"> </td>
<td colspan="3"> <form name="form2" method="post" action=""> <table
width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="RegCopy" width="14%" height="28">Employee</td>
<td class="RegCopy" width="74%"
height="28"><%=(rs1.Fields.Item("User").Value)%></td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr>
<td class="RegCopy" width="14%" height="28">Job Number</td>
<td class="RegCopy" width="74%"
height="28"><%=(rs2.Fields.Item("JobNumber").Value)%></td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr>
<td class="RegCopy" width="14%" height="28">Select Date
</td>
<td class="headingblue" width="74%" height="28">
<select size="1" name="StevesDate" style="font-size:
8pt" class="headingblue">
<%
for i = weekd to 1 step -1
curDate = dDate - weekd + i
%>
<option <%=curDate%>
value="1"><%=FormatDateTime(curDate,1)%></option>
<%
'''''second argument given to FormatDateTime is vbLongDate=1
next
%>
</select>
<%
Sub fromSunday()
Dim dDate, weekd, i, curDate
dDate = date
weekd = weekday(dDate)
End Sub
%>
</td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr>
<td class="RegCopy" width="14%" height="28">Enter
Time</td>
<td class="RegCopy" width="74%" height="28"> Hours
<select name="hours">
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
</select>
Minutes
<select name="minutes">
<option value="00" selected>00</option>
<option value="15">15</option>
<option value="30">30</option>
<option value="45">45</option>
</select>
</td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr align="left" valign="top">
<td class="RegCopy" width="14%" height="28">Notes</td>
<td class="RegCopy" width="74%" height="28">
<textarea name="notes" cols="75"></textarea>
</td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr>
<td class="RegCopy" width="14%" height="28"> </td>
<td class="RegCopy" width="74%" height="28">
<input type="submit" name="Enter" value="Enter">
<input type="reset" name="Reset" value="Reset">
</td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
<td class="RegCopy" width="4%" height="28"> </td>
</tr>
<tr>
<td class="RegCopy" width="14%" height="24"> </td>
<td class="RegCopy" width="74%" height="24"> </td>
<td class="RegCopy" width="4%"> </td>
<td class="RegCopy" width="4%"> </td>
<td class="RegCopy" width="4%"> </td>
</tr>
</table>
</form>
</td>
<td width="1%"> </td>
</tr>
<tr>
<td width="1%"> </td>
<td width="22%" class="RegCopy"> </td>
<td width="43%" class="RegCopy"> </td>
<td width="33%" class="RegCopy"> </td>
<td width="1%"> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
rs1.Close()
%>
<%
rs2.Close()
%>
"Deepa Jacob" <deepa_k...@hotmail.com> wrote in message
news:uhrk3kJ6BHA.2116@tkmsftngp02...
Replace
the following part of the code
with
------------------------------------------------------------------
------------------------------------------------------------------
------------------------------------------------------------
<td class="headingblue" width="74%" height="28">
<select size="1" name="StevesDate" style="font-size:
8pt" class="headingblue">
<%
for i = weekd to 1 step -1
curDate = dDate - weekd + i
%>
<option <%=curDate%>
value="1"><%=FormatDateTime(curDate,1)%></option>
<%
'''''second argument given to FormatDateTime is vbLongDate=1
next
%>
</select>
<%
Sub fromSunday()
Dim dDate, weekd, i, curDate
dDate = date
weekd = weekday(dDate)
End Sub
%>
</td>
-------------------------------------------------------------
"Steve" <Ste...@popmail.com> wrote in message
news:O8#4HdK6BHA.2332@tkmsftngp05...
"Steve" <Ste...@popmail.com> wrote in message
news:O8#4HdK6BHA.2332@tkmsftngp05...
"Deepa Jacob" <deepa_k...@hotmail.com> wrote in message news:OrPRqwK6BHA.2240@tkmsftngp04...
"Deepa Jacob" <deepa_k...@hotmail.com> wrote in message news:OrPRqwK6BHA.2240@tkmsftngp04...
"Steve" <Ste...@popmail.com> wrote in message news:#zbTldL6BHA.1624@tkmsftngp02...