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
Inspiration Quote
by Angie - 04/17/24 03:33 PM
Sew a Garden Flag
by Cheryl - Sewing Editor - 04/17/24 01:24 PM
Review - Notion for Pattern Designers: Plan, Organ
by Digital Art and Animation - 04/17/24 12:35 AM
Review - Create a Portfolio with Adobe Indesign
by Digital Art and Animation - 04/17/24 12:32 AM
Psalm for the day
by Angie - 04/16/24 09:30 PM
Check Out My New Website Selective Focus
by Angela - Drama Movies - 04/16/24 07:04 PM
Astro Women - Birthdays
by Mona - Astronomy - 04/12/24 06:23 PM
2024 - on this day in the past ...
by Mona - Astronomy - 04/12/24 06:03 PM
Useful Sewing Tips
by Cheryl - Sewing Editor - 04/10/24 04:55 PM
"Leave Me Alone" New Greta Garbo Documentary
by Angela - Drama Movies - 04/09/24 07:07 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