...

View Full Version : asp and dates



esthera
12-31-2006, 07:25 PM
can someone help me?
I need to create a function that I will pass in a date and it will retunr the 2 dates that date is in with the first date being friday 1:00 to the last datetime being thursday 12:59

degsy
01-12-2007, 03:58 PM
Your question makes no sense to me.

You can use DateAdd and WeekDay to get specifc dates from a passed date.
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp

degsy
01-15-2007, 11:10 AM
Example


<%
Function getDate(theDate)
Do
numDays=numDays+1
newDate = DateAdd("d",numDays,theDate)
Loop Until WeekDay(newDate) = 6

If numDays=1 Then
numDays = "tomorrow"
Else
numDays = "in " & numDays & " days"
End If

getDate = "The next Friday is " & numDays & " on " & newDate
End Function

myDate1 = "11/1/2007"
myDate2 = "12/1/2007"
myDate3 = "18/1/2007"

Response.Write "Date: " & myDate1 & ". " & getDate(myDate1) & "<br>"
Response.Write "Date: " & myDate2 & ". " & getDate(myDate2) & "<br>"
Response.Write "Date: " & myDate3 & ". " & getDate(myDate3) & "<br>"
Response.Write "Date: " & Date & ". " & getDate(Date) & "<br>"
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum