67

I want to convert DateTime.Today to GMT time.

i.e. If I am in L.A. and it is 11pm of 22/02/2012 I want DateTime.Today to be 23/02/2012 because it will be that day in GMT time.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
Tony
  • 10,088
  • 20
  • 85
  • 139
  • 1
    With GMT you mean UTC, and not `Europe/London`, right? – CodesInChaos May 29 '12 at 16:42
  • 10
    Since this question was the starting point of some controversy, I take the opportunity to promote [Earth Standard Time](http://xkcd.com/1061/). – Filburt May 29 '12 at 18:32
  • @filburt - LOL! that is so hilarious! but i think most of the humor comes from being familiar with the whole UTC claims and various calendar & time standards. but absolutely hilarious! thx for sharing! i had to save that pic! – Shawn Kovac Sep 22 '14 at 15:10

3 Answers3

177

There is no DateTime.UtcToday, but you can try DateTime.UtcNow.Date

CodesInChaos
  • 106,488
  • 23
  • 218
  • 262
Carsten Schütte
  • 4,408
  • 1
  • 20
  • 24
  • i came here wondering whether DateTime.Today returned the date of the local time or the date of the UtcTime. this question and answer answers my question! thx! – Shawn Kovac Sep 22 '14 at 15:12
  • 37
    Decompiling DateTime.Today results in: `public static DateTime Today { get { return DateTime.Now.Date; } }` – Cristian Diaconescu May 16 '15 at 22:34
-1

DateTime LocalToGMT = DateTime.Now.ToUniversalTime().AddHours(TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time").BaseUtcOffset.Hours);

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 05 '22 at 19:36
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31464762) – John V Apr 10 '22 at 02:55
-2

DateTime.UtcNow will give you the current universal time.

Ivar
  • 5
  • 4
rirajat
  • 91
  • 1