GetStandardChangeDate Function:
Returns daylight saving change date (Last Sunday in October)
Description:
GetStandardChangeDate Function returns the daylight saving change date (Last Sunday in October)
Syntax:
date = GetStandardChangeDate(dateType)
Details:
Argument: dateType: the returned date type either vbGeneralDate vbLongDate vbShortDate
Example:
<%
response.write GetStandardChangeDate(vbShortDate) '--- returns 28/10/2007
%>
ASP Source Code:
<%
Private Function GetStandardChangeDate(ByVal dateType) '--- Finds the last Sunday in October '--- the Standard time change date '--- the time is 2 am Dim tmp Dim dteDate Dim blnFound Dim iMonth, iday iMonth = 10 dteDate = "10/24/" & Year(Now) Do Until blnFound If Weekday(dteDate) = vbSunday Then iday = Day(dteDate) blnFound = True Else dteDate = DateAdd("d", 1, dteDate) End If Loop If iday = 24 Then iday = iday + 7 End If tmp = DateSerial(Year(Now), 10, iday) Select Case dateType Case vbGeneralDate: tmp = FormatDateTime(tmp, vbGeneralDate) Case vbLongDate: tmp = FormatDateTime(tmp, vbLongDate) Case vbShortDate: tmp = FormatDateTime(tmp, vbShortDate) End Select GetStandardChangeDate = tmp End Function
%>
|