INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

#### Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
To Your Posts
• Keyword Search
• One-Click Access To Your
Favorite Forums
• Automated Signatures
On Your Posts
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Is DATE BST or GMT. DST Daylight Saving Time Check

 Forum Search FAQs Links MVPs

## Is DATE BST or GMT. DST Daylight Saving Time Check

(OP)
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.

#### 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!

### RE: Is DATE BST or GMT. DST Daylight Saving Time Check

Do you have access to a SQL Server? If you have a newer version you can use functions like GETUTCDATE, SYSUTCDATETIME, SYSDATETIMEOFFSET to do the work for you. Use a DB query in ASP to get your "isBST" binary result.

BTW: Kudos to you for saying "Daylight Saving Time" and not "Savings Time."

Dave
[http://flashspot.com]

### RE: Is DATE BST or GMT. DST Daylight Saving Time Check

(OP)
Hi El, thank you for the reply.

Unfortunately I'm quite limited here as to how much access I have and how able I am do delve deeper. I'm hoping to achieve this client side using the variable provided in the code itself...

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

### Reply To This Thread

#### Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!

Already a member? Close this window and log in.