Hello I'm trying to check whether a given date is within the UK classifcation of Daylight Saving Time.
I have a function that was written in VBA and I need to convert it to VBScipt to use on my .asp page.
I basically have a date/time value in the following format: YYYY-MM-DDTHH:MM:SS
I need to break this down and establish whether or not that date/time falls within UK British Summer Time.
I would really appreciate somebody helping me convert this into a working asp file.
SOMEBODY PLEASE HELP ME!
I have a function that was written in VBA and I need to convert it to VBScipt to use on my .asp page.
I basically have a date/time value in the following format: YYYY-MM-DDTHH:MM:SS
I need to break this down and establish whether or not that date/time falls within UK British Summer Time.
I would really appreciate somebody helping me convert this into a working asp file.
Code:
Function isBST(PickupDate As Date) As Boolean
Dim PickUpWeekDay As Byte ' ---- The index number of the day of the week
Dim PickUpDay As Integer ' ---- The day of the month
Dim PickUpMonth As Integer ' ---- The number of the month
isBST = False ' ---- Start by assuming we're not in BST
'--- As we we're comparing against an 01:00 cutoff, we will subtract an hour from the pickup time...
'--- ... it is easier to drop an hour and compare against an 00:00 cutoff as we can ignore any time element.
PickupDate = 2015-11-08T14:45:00
PickupDate = DateAdd("h", -1, PickupDate)
PickUpWeekDay = Weekday(PickupDate, vbSunday) ' --- get the index of the weekday (1 for Sunday etc...)
PickUpDay = Day(PickupDate) ' --- get the day of the month of the pickup
PickUpMonth = Month(PickupDate) ' --- get the number of the month of the pickup
'If between April and September then BST is true
If PickUpMonth > 3 And PickUpMonth < 10 Then
isBST = True
'If after last Sunday in March then BST is true
ElseIf PickUpMonth = 3 And PickUpDay + (7 - PickUpWeekDay) > 30 Then
isBST = True
'If before last Sunday of October then BST is true
ElseIf PickUpMonth = 10 And PickUpDay + (7 - PickUpWeekDay) < 30 Then
isBST = True
Else
isBST = False
End If
End Function
If isBST = True Then
Response.Write PickupDate & "is BST"
End If
If isBST = False Then
Response.Write PickupDate & "is NOT BST"
End If
SOMEBODY PLEASE HELP ME!