GMT-8 to GMT+0 (UK) with consideration for british summer time?

I'm using a server where it's time is GMT-8.

Im using DateTime so how do i convert it to GMT+0 taking into consideration British summer time as im based inthe UK.

Thanks for your time.

Paul.



Answer this question

GMT-8 to GMT+0 (UK) with consideration for british summer time?

  • Whoisit

    The Pacific timezone has its own rules for daylight savings time. Try very hard to obtain the UTC time of the server resource. Windows stores all file times in UTC so as long as you are just transferring/referencing files, you should have a chance to obtain that. After that, it is simple, just translate the UTC time with the FileTimeToSystemTime() API...



  • Vinodonly

    Thanks Peter. But I cannot see the Convert method in the TimeZone, one reason why I mentioned perhaps using the ToLocalTime() Am I missing something

  • Joshizzle

    Another killer nobugz post -- marked as helpful! UTC time is always a good starting point.



  • vdv_phuong

    Take a look at the TimeZone class:

    DateTime localTime = TimeZone.CurrentTimeZone.ToLocalTime(datetime);

    Otherwise I believe it will be to do with the culture area. I think you may need to also implement the IFormatProvider at some stage to give the local culture/take it into consideration using the DateTime.TryParse() method

    I could be wrong however, only just spotted the class and looking through the docs!



  • progames25

    ahmedilyas wrote:
    Thanks Peter. But I cannot see the Convert method in the TimeZone, one reason why I mentioned perhaps using the ToLocalTime() Am I missing something
    Sorry, my quoted "convert" wasn't meant to suggest using a method named "Convert". Yes, gernally ToLocalTime() is what you use tp convert to a local time.

  • rc_onecall

    D'oh! Such a tease :-) Maybe in .NET 3.0 (unlikely but would be a nice addition)

  • SOTY_Programmer

    Anthony Moore and Kathy Kam have been publicly pontificating the evolution of DateTime as it applies to conversion between locales (see Designing "Time Zone Conversions").

    But Dan Rogers has a good article Coding Best Practices Using DateTime in the .NET Framework. It was written before .NET 2.0 came out. .NET 2.0 doesn't have anything "inherent" to deal with timezone conversions. The best advice is to only use UTC in your implementation and "convert" to a local time (including timezone) when displaying the date/time. The above article as a section on "Daylight Savings Time", which is North America's term for when clocks should move forward and backward in different times of the year (I'm assuming "Summer Time" is similar).



  • kasumi241026

    I was actually reading the Kathy article and it gave code snippets using Convert in the TimeZone - just couldnt find it, thought I was being silly and missing something (probably am!)

  • CemSharp

    ahmedilyas wrote:
    D'oh! Such a tease :-) Maybe in .NET 3.0 (unlikely but would be a nice addition)
    I think what's she's been discussing is for the Orcas timeframe. Considering the first release candidate for .NET 3.0 was released the 1-Sep-06, it's very unlikely you'll see any of what Kathy is discussing in .NET 3.0

  • Muricy

    ahmedilyas wrote:
    I was actually reading the Kathy article and it gave code snippets using Convert in the TimeZone - just couldnt find it, thought I was being silly and missing something (probably am!)
    Ah, okay. No Kathy is just showing possible additions to the TimeZone and DateTime classes for feedback, they don't actually exist in the RTM.

  • GMT-8 to GMT+0 (UK) with consideration for british summer time?