Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Calculate Friday dates only

Reply
Thread Tools

Calculate Friday dates only

 
 
David
Guest
Posts: n/a
 
      02-14-2007
Hi,

I need to display 3 fields with future dates (Fridays only) as table
column headers.
i.e. 16th Feb | 23rd Feb | 2nd March.

As each week passes, i.e. from the Saturday, the dates should move
accross 1, i.e. column 1 will update to 23rd Feb, Column 2 to 2nd
March and Column 3 to 9th March.

23rd Feb | 2nd March. | 9th March

I need this to work in IE & Firefox specifically.

Please can you help me work this out ?

Thanks


David

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-14-2007
David wrote:
> Hi,
>
> I need to display 3 fields with future dates (Fridays only) as table
> column headers.
> i.e. 16th Feb | 23rd Feb | 2nd March.
>
> As each week passes, i.e. from the Saturday, the dates should move
> accross 1, i.e. column 1 will update to 23rd Feb, Column 2 to 2nd
> March and Column 3 to 9th March.
>
> 23rd Feb | 2nd March. | 9th March
>
> I need this to work in IE & Firefox specifically.
>
> Please can you help me work this out ?
>

It shouldn't be too hard. Assuming that if today were Friday, you would want
today's date in column one:

<%
dim today, nextfriday
today=date
nextfriday=today
do until weekday(nextfriday) = vbFriday
nextfriday = nextfriday + 1
loop
%>
<html>
<head>
<style>
th {background-color:gray;color:white}
</style>
</head>
<body>
<table>
<tr>
<th><%=nextfriday%></th>
<th><%=nextfriday + 7%></th>
<th><%=nextfriday + 14%></th>
</tr>
</table>
</body></html>


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      02-14-2007
Bob Barrows [MVP] wrote on 14 feb 2007 in
microsoft.public.inetserver.asp.general:

> <%
> dim today, nextfriday
> today=date
> nextfriday=today
> do until weekday(nextfriday) = vbFriday
> nextfriday = nextfriday + 1
> loop
> %>


Look, no loop:

today = date
temp = vbFriday - weekday(today)
if temp<0 then temp = temp + 7
nextfriday = dateadd("d", temp, today)
nextnextfriday = dateadd("ww", 1, nextfriday)
nextnextnextfriday = dateadd("ww", 2, nextfriday)


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calculate day, hour , sec between dates Alexandre Jaquet Java 13 05-28-2007 10:02 AM
calculate day, hour , sec between dates Alexandre Jaquet Java 0 05-22-2007 02:27 PM
calculate day's between two dates Tom C++ 6 03-16-2006 06:07 PM
Dates dates dates dates... SQL and ASP.NET David Lozzi ASP .Net 1 09-30-2005 02:18 PM
Dates! Dates! Dates! PW ASP General 4 08-09-2004 04:42 PM



Advertisments