Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change timezone in C#

I have a date format, something similar to:

Mon, Sun, 22 Aug 2010 12:38:33 GMT

How do I convert this to EST format?

Note: I know it can be achieved using TimeZoneinfo, but that is introduced in 3.5, i want to do it 2.0 or any old version.

like image 377
Wondering Avatar asked Apr 09 '26 12:04

Wondering


1 Answers

I guess you have to go the old road of understanding timezones. Your example is though pretty easy.

GMT is UTC with daylight saving changes.
EST is UTC -5hrs with daylight saving changes.

So you just have to substract 5 hours to get the time in EST.

like image 188
Dan Dumitru Avatar answered Apr 11 '26 01:04

Dan Dumitru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!