473,399 Members | 3,888 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.

Date question

I have a form field area that I need to always have display the
upcoming thursday date. ie. this week I would need the form field
area to display 3/1/2007. Then beginning on the Friday 3/2/07 i need
it start displaying 3/8/2007. any suggestions..

Feb 24 '07 #1
3 1183
Matt wrote on 24 feb 2007 in microsoft.public.inetserver.asp.general:
I have a form field area that I need to always have display the
upcoming thursday date. ie. this week I would need the form field
area to display 3/1/2007. Then beginning on the Friday 3/2/07 i need
it start displaying 3/8/2007. any suggestions..
Form fields are for client input, methinks,
so what you "need" could not be what you want.

vbscript:

theDate = Date()
n = 5 - weekday(theDate)
if n<0 then n = n + 7
nextThursday = dateAdd("d",n,theDate)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 24 '07 #2
"Matt" wrote:
I have a form field area that I need to always have display
the upcoming thursday date. ie. this week I would need the
form field area to display 3/1/2007. Then beginning on the
Friday 3/2/07 i need it start displaying 3/8/2007.
Then you would probably be interested in the Weekday Function:
http://msdn.microsoft.com/library/en...09a72491bd.asp

Here's a VBScript function that will produce the requested "next thursday":

Function NextThursday(d)
NextThursday = DateAdd("d",7-Weekday(d,6),d)
End Function

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

Feb 24 '07 #3
This could probably be refined more, but for SQL Server, and first day of
week set to Sunday -

declare @day_of_week int
declare @days_left_in_week int
declare @cut_off int
declare @next_day int

select @day_of_week = DATEPART(dw, GETDATE())
select @days_left_in_week = 7 - @day_of_week
select @cut_off = 6 -- Friday
select @next_day = 5 -- Thursday

if @day_of_week >= @cut_off
begin
select getdate() + @next_day + @days_left_in_week
end
else
begin
select getdate() + @next_day - @day_of_week
end
-- end if

Bob Lehmann

"Matt" <mw******@caldrywall.comwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
I have a form field area that I need to always have display the
upcoming thursday date. ie. this week I would need the form field
area to display 3/1/2007. Then beginning on the Friday 3/2/07 i need
it start displaying 3/8/2007. any suggestions..

Feb 24 '07 #4

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

Similar topics

2
by: mirza i | last post by:
thanks for the previous replies. here is the new question (i'm absolutely sure that this should be VERY easy for a good js coder) ok: from asp i call: <img src="pics/cal.gif"...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
10
by: dan | last post by:
Am i breaking any rules when I loop dates like // Determine Memorial Day intFlag = 0; memDayHol = new Date (currentYear, 4, 31); while (intFlag == 0) { if (memDayHol.getDay() == 1) {intFlag...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.