2 Replies - 1640 Views - Last Post: 17 October 2011 - 02:57 PM Rate Topic: -----

#1 runewake2   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 60
  • Joined: 23-February 08

DateTime.Now.Hour

Posted 16 October 2011 - 08:33 PM

I am writing a Binary Clock app for the Zune (yes someone still uses one) and am having some trouble with DateTime.Now.Hour. It is giving me a time that is not synced to my device. Specifically the time is 3 hours ahead.

Unfortunately this is not the same for all Zunes (i believe it is the time in the Microsoft HQ on the West Coast). The thing is, with a clock the time of some other place is not really all that helpful.

Does anyone know a good alternative to DateTime.Now.Hour? All other functions are spot on (as it's just a time zone difference) but this is not really what I was looking for.

Thanks, runewake2.

Is This A Good Question/Topic? 0
  • +

Replies To: DateTime.Now.Hour

#2 Momerath   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1021
  • View blog
  • Posts: 2,463
  • Joined: 04-October 09

Re: DateTime.Now.Hour

Posted 16 October 2011 - 10:00 PM

This is a known issue and I doubt anything will be done to fix it now.

There are several things you can try, though. Use DateTime.UtcNow to get the DateTime, then try calling ToLocalTime() on it. Use the TimeZoneInfo.ConvertTime on the UTC time. Get the timezone information and add it to the UtcNow time.
Was This Post Helpful? 0
  • +
  • -

#3 runewake2   User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 60
  • Joined: 23-February 08

Re: DateTime.Now.Hour

Posted 17 October 2011 - 02:57 PM

That doesn't work. It gives the same result as Now. I'll just have to work in a way to modify the TimeZone.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1