Previous Thread
Next Thread
Print Thread
#145137 08/11/04 11:38 AM
Joined: Aug 2004
Posts: 1
frechcm Offline OP
OP Offline
Joined: Aug 2004
Posts: 1
I am trying to use the date function to display the date from Saturday to Friday and automatically change each week. For example: 8/8/04 - 8/13/04 then show 8/14/04 - 8/20/04. Can someone help?

Sponsored Post Advertisement
#145138 09/01/04 10:53 PM
Joined: Sep 2004
Posts: 2
Joined: Sep 2004
Posts: 2
This should take care of the date format you're looking for; just move the "response.write" line to where you want the date string to be rendered on your page.

Good luck!

function GetDateRange(ByVal adt_Date)
	dim ldt_BeginDate
	dim ldt_EndDate

	'---if we don't have a valid date to evaluate
	'   use today's
	if not isDate(adt_Date) then adt_Date = Date()
	'---check to see if today's date is a saturday
	'   if not, "walk" back one day at a time until
	'   we find last Saturday's date
	if DatePart("w", adt_Date) = 7 then
		ldt_BeginDate = adt_Date
		do until DatePart("w", adt_Date) = 7
			adt_Date = DateAdd("d", adt_Date, -1)
		ldt_BeginDate = adt_Date
	end if
	'---return a string based on the most recent Saturday, and
	'   and the date 6 days after that.
	GetDateRange = cstr(ldt_BeginDate) & " - " & cstr(DateAdd("d", ldt_BeginDate, 6))
end function

response.write GetDateRange(Date())

Moderated by  Lisa LowCarb 

Link Copied to Clipboard
Brand New Posts
2023 - on this day in the past . . .
by Mona - Astronomy - 10/03/23 11:04 AM
Inspiration Quote
by Angie - 10/03/23 09:36 AM
Psalm for the day
by Angie - 10/03/23 09:19 AM
Astro Women - Birthdays
by Mona - Astronomy - 10/01/23 02:53 PM
Astronomical Doodles
by Angie - 09/29/23 07:34 PM
Denmark's Oscar Entry "The Promised Land"
by Angela - Drama Movies - 09/29/23 05:14 PM
Sewing with Flannel
by Cheryl - Sewing Editor - 09/27/23 09:33 PM
Gift/Book Shop
by Angie - 09/25/23 10:06 PM
Autumn Equinox
by Angie - 09/25/23 10:03 PM
Garden Wisdom
by Angie - 09/17/23 09:57 PM
We take forum safety very seriously here at BellaOnline. Please be sure to read through our Forum Guidelines. Let us know if you have any questions or comments!
This forum uses cookies to ensure smooth navigation from page to page of a thread. If you choose to register and provide your email, that email is solely used to get your password to you and updates on any topics you choose to watch. Nothing else. Ask with any questions!

| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2022 Minerva WebWorks LLC. All rights reserved.

Powered by UBB.threads™ PHP Forum Software 7.7.5