In PHP, you can write the following:
date_default_timezone_set("UTC");
How do I do I write this in C#?
Also, how do I write this:
declare(ticks=1);
in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In c#, the timezone is built into the DateTime structure, so you should not need to set the default. Instead when you are manipulating DateTime instances you use the UTC version of methods. For example, in the constructor you can specify if the date supplied is local or UTC.
With regards to the second question, are you just wanting the syntax of
If you are trying to add a time period to a date, you should use a TimeSpan, along the lines of: