One of the unintended consequences of tidying my desk is that I now have a couple of speakers evenly on both sides of my laptop so I am now getting the full stereo effect in music. It really is surprising how much better music sounds in stereo – although wearing headphones is even better.

I have been working on a bug with some software for a while… It is with date parsing. The system can send me data in two different formats. And VB.NET has an issue… I am importing data and it thinks it is in the local timezone, but the data is in UTC, or universal time. This is creating a few hassles for me. The problem is that I have solved this before and I cannot remember how I did it. I do know it was a pain to solve.

After some playing I found the following line…
TimeZone.CurrentTimeZone.GetUtcOffset(Now).TotalMinutes
What this does on the .Net world is returns the number of seconds between UTC time and local time. So if I import data with the wrong timezone I can offset things. So simple… Provided I can work out if to add or subtract from the time…

P.S. Edit 30 minutes later… An issue/Bug..

Firstly I had an issue with the following line
time = Date.ParseExact(mArray(Fields.Time), “dd/MM/yyyy H:mm:ss tt”, Nothing)
The tt understands AM or PM. Unfortunately it then ignores AM or PM. Probably something to do with the H in the hour field. But the following code fixed things…
If InStr(mArray(Fields.Time), “PM”) > 0 Then
time = time.AddHours(12)
End If

Why isnt programming easy? ARGH!