logo
Previous Thread
Next Thread
Print Thread
#145137 08/11/04 11:38 AM
Joined: Aug 2004
Posts: 1
frechcm Offline OP
Newbie
OP Offline
Newbie
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
Newbie
Offline
Newbie
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!

Code:
  
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
	else
		do until DatePart("w", adt_Date) = 7
			adt_Date = DateAdd("d", adt_Date, -1)
		loop
		
		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
Make It Sew Easier
by Cheryl - Sewing Editor - 03/27/24 04:34 PM
2024 - on this day in the past ...
by Mona - Astronomy - 03/27/24 01:31 PM
Planner Template Kit - Weekly Layout Template
by Digital Art and Animation - 03/26/24 07:39 PM
Planner Template Kit - Yearly Layout Template
by Digital Art and Animation - 03/26/24 07:37 PM
How to Use Digital Planner Template Kit
by Digital Art and Animation - 03/26/24 07:36 PM
Review - 20 Illustrator Color tips Helen Bradley
by Digital Art and Animation - 03/26/24 07:32 PM
March Equinox to June Solstice
by Mona - Astronomy - 03/26/24 12:27 PM
Hobotrader unleashes never seen opportunity with i
by Jamal molla - 03/26/24 11:55 AM
Psalm for the day
by Angie - 03/25/24 09:05 AM
Genealogy, Sort of
by Angie - 03/24/24 05:39 PM
Sponsor
Safety
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!
Privacy
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