Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use timezone with gmt format what ever in Timezone.
Posted

Use the TimeZoneInfo class found in System.Core;

You must set the DateTimeKindto DateTimeKind.Utc for this.

C#
DateTime MyTime = new DateTime(1990, 12, 02, 19, 31, 30, DateTimeKind.Utc);

DateTime MyTimeInWesternEurope = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(MyTime, "W. Europe Standard Time");


Please refer: Converting Times Between Time Zones[^]
also check similar discussion:C#: Making sure DateTime.Now returns a GMT[^]
 
Share this answer
 
If you want to use GMT as reference for time or you want to use relative time then parhaps the easiest and efficient way to do it us using DateTimeOffset. Bit to use this you will be needing framework version 4.0 atleast.

http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900