How to format a datetime to GMT irrespective of regional settings?
问题 I have a datetime stored in the database as GMT. I need to format this datetime as a string together with the timezone offset to UTC, for example: DateTime date = DateTime.Parse("2012-03-15 12:49:23"); string dateAsString = date.ToString("yyyy-MM-ddTHH:mm:ss.fffzzz"); 2012-03-15T12:49:23.000+00:00 This code works on my machine in the UK. When I change my regional settings to a different time zone, for example Perth, I get the following output: 2012-03-15T12:49:23.000+08:00 I need the string