how can I convert System.DateTime.Now to UTC time?

Hi,
I am using c# in Visual Studio 2005

I have the followin object:
System.DateTime currentTime = new DateTime.Now

I need for currentTime variable to be UTC time. How can I do this?

Thanks
vielkacarolina1239Asked:
Who is Participating?
 
CuteBugConnect With a Mentor Commented:
Use DateTime.UtcNow
0
 
joriszwaenepoelConnect With a Mentor Commented:
DateTime.UtcNow is correct for the current time.

If you need to convert other datetimes as well, then you can use ".ToUniversalTime" to ceonvert an existing (local) datetime to UTC.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.