Solved

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

Posted on 2008-06-25
2
914 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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 and create keystrokes in Netbeans IDE 8.0 for Windows.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now