I am writing this piece of code in a C# application in MS Visual studio. I want to use GMT (or UTC) time throught in the application. I do not want to use the local time to show up anywhere in the application page.
Here are my code -- it does not compile:
DateTime date1 = Convert.ToDateTime(runDate
);
string newTime = date1.ToString("yyyy-MM-dd
' 'HH:mm:ss");
dr["LastUsedDate"] = Convert.ToDateTime(newTime
);
I can compile the code but when I execute, I get error on the last line (3rd line) in the above code -- it says that the argument to ToDateTime -- that is newTime is not in correct format.
How can I fix this?
-tooki
Start Free Trial