473,322 Members | 1,421 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,322 software developers and data experts.

Calculate Friday dates only

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

Feb 14 '07 #1
2 2140
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"
Feb 14 '07 #2
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)
Feb 14 '07 #3

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

Similar topics

26
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
5
by: SimonC | last post by:
Help needed for a Javascript beginner. As above in the subject... i need a javascript to run this, but not in the form of a web-page. I want to calculate it between 2 fields in a database that...
5
by: Hardy Wang | last post by:
Hi: Are there any algorithms I can use, that based on a given date and a culture code (different cultures may have different beginning of week), I can get first and last date of the current week?...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
11
by: CK | last post by:
Hi All, Looking for a simple function to return the date for the follwing Friday. I send out emails from time to time and I would like a function that dynamically returns the date for the...
0
by: SuzK | last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are Week Ending (date) ItemNbr (double) Sales Dollars...
4
by: muddasirmunir | last post by:
i am using vb6. what i need is to calculate X (means any ) working day date skipping holidays (saturday and sunday) or (friday or saturday in some contries) for example: today is 20-06-2008...
5
FishVal
by: FishVal | last post by:
IMHO, the following is not a how-to-do instruction to solve a particular problem but more a concept-proof stuff demonstrating possibilities of SQL. So, let us say the problem is to calculate...
8
code green
by: code green | last post by:
I need to generate the date for the latest Friday and the Saturday previous to this ie 7 days. I am generating reports for the periods Yesterday, Month to date and Sat-Fri so I create the dates in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.