1

Basically I want to convert US time (hosting Server time) to GMT (UK Summer Time)

technology C#, .NET 4.0, TimeZoneInfoClass

Detailed scenario:

I am creating a SMS sending application.It should not send sms from 10.00PM to 6.30 AM UK Time or GMT.

Server resides in US or suppose anywhere in the world.

So my approach is

  • I am assuming that Hosting server has Auto Day Light Adjusting Patch. So I don't check for hosting Server daylight saving. Is that Ok??

  • It adjust for US time automatically & I will get correct time through UTCNow()

  • I get GMT time from timezoneinfoclass or Time.UTCNow() method. Now I have correct UTC time & I have to check for Daylight saving a/c to UK time (targeted timezone)

  • lastly I check parameter for targeted timezone (i.e UK) like Datetime,UTCoffset,IsDayLightSaving,SupportDaylightSaving based on Machine Time Zone ID (GMT time zone London..). eg:-timezoneid.local.searchbyma..(GMT) //*Syntax)

    if (IsDayLightSaving==true)
    {
        UTC.AddHours(1)   //syntax is not correct
    }
    else
    {
        // GMT= UK time
    }
    

OS I Have following questions :-

  1. Is This a good approach or flawed one ? What are the alternatives?

  2. Should I check for daylight saving for hosting timezone & then correct the offset by adding one hour if it is DST ??

  3. Any free reliable web services for getting GMT time?

Please suggest

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
panky sharma
  • 2,029
  • 28
  • 45

0 Answers0