To Unix Date Time - CSharp System

CSharp examples for System:DateTime Unix

Description

To Unix Date Time

Demo Code

// Copyright (c)2008-2011 Mark II Software, LLC.  All Rights Reserved.
using System.Text;
using System.Collections.Generic;
using System;/*from w ww.j a va 2 s.c  o m*/

public class Main{
        // http://www.codeproject.com/KB/cs/timestamp.aspx
		public static double ToUnixDateTime(this DateTime d)
		{
			DateTime baseDT = new DateTime(1970, 1, 1, 0, 0, 0, 0);
			TimeSpan span = d.ToUniversalTime() - baseDT;
			return span.TotalSeconds;
		}
}

Related Tutorials