0

I'm writing a system which will be used in the US, however it must make reference to the current UK time.

I need an offline solution which will display the current UK time (taking into account GMT and BST)

Is there an inbuilt function in vb.NET which can handle this, or is there a programatic way of retrieving this value?

  • Possible duplicate of [VB.NET - Find current timezone, then convert to Pacific](https://stackoverflow.com/questions/14312952/vb-net-find-current-timezone-then-convert-to-pacific) – Devon Aug 17 '17 at 12:10
  • As the UK uses 2 timezones, I need to be able to know which timezone it is in. (GMT or BST) and return this. So 5am in US would be 13:00 or 14:00 depending on daylight saving – Lord Nodral III Aug 17 '17 at 12:15
  • @LordNodralIII have you looked at this? https://stackoverflow.com/questions/10665678/check-if-daylight-savings-is-in-effect – Sasha Aug 17 '17 at 12:39

1 Answers1

1
Dim dt as DateTime
dt = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.UtcNow, "GMT Standard Time")

This gets the current time in UTC, and converts it to the time in the United Kingdom. Do not be confused by the wording of the time zone identifier, it indeed covers both GMT and BST, and the transitions between them.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575