Unix epoch in C#

  • Thread starter Maziar Aflatoun
  • Start date
M

Maziar Aflatoun

Hi,

Can someone please tell me how I can set DateTime to 01/01/1970 (UTC).
Doing the following

DateTime dt1 = new DateTime(1970, 1,1);
Debug.WriteLine("dt1(utc):"+ dt1.ToUniversalTime().ToString());

Doing the following returns 1/1/1970 5:00:00 AM

However, I want to set the DateTime so that it would return 1/1/1970
12:00:00 AM instead.

Basically force DateTime(1970,1,1) to be UTC.

Thanks
Maz.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,084
Latest member
HansGeorgi

Latest Threads

Top