Solved

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

Posted on 2008-06-25
2
916 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:vielkacarolina1239
2 Comments
 
LVL 16

Accepted Solution

by:
CuteBug earned 400 total points
ID: 21866153
Use DateTime.UtcNow
0
 
LVL 10

Assisted Solution

by:joriszwaenepoel
joriszwaenepoel earned 100 total points
ID: 21866352
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question