My system having India time and my array contains all the countries GMT time.

How to do the calculation to get the other country time?

if my time is 5.00 P.M if the country is Pakistan it should show 4.30 p.m


Actually, it's a very simple function (if I understood your problem clearly):

DateTime createdUTC; //declare a datetime variable

// logic to assign some value in variable "createdUTC". Say, at this moment, the value is in UTC (previously known as GMT) format.

DateTime createdLocal = DateTime.FromFileTime(createdUTC.ToFileTime()); //this line converts "createdUTC" into long type internal variable, which will be used to convert into local datetime variable.

Hope this helps.


Look into the System.TimeZoneInfo class (.NET 3.5/4.0). Since you have the UTC list for the country then it is a matter of getting the local time and doing the conversion from/to UTC

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.