Author: nightzeus | Posted on: 11/17/2009 7:58:40 PM | Views : 401

I want to compare a UTC datetime (string) to the current UTC datetime, but do I need to cast the string as UTC some how after converting it to a DateTime? For example:

string utcDateTime = "11/16/2009 11:00:00 AM"; if ((UTCcast)Convert.ToDateTime(utcDateTime) > DateTime.UtcNow) { //do something }


How do I make sure that my string is not converted to a regular datetime (datetime with timezone, daylight savings) when comparing to a UTC datetime?


To explain more:
DateTime utcDateTime = Convert.ToDateTime("11/16/2009 11:00:00 AM"); //a UTC datetime and a regular (local) datetime would produce different responses Response.Write(utcDateTime.AddDays(100));

...

Go to the complete details ...