Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-06-25
2
Medium Priority
?
920 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

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

Assisted Solution

by:joriszwaenepoel
joriszwaenepoel earned 400 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

636 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