CSharp examples for System:DateTime UTC
Convert datetime to UTC time, as understood by Facebook.
using System;//w w w . j a va 2 s. c o m public class Main{ /// <summary> /// Convert datetime to UTC time, as understood by Facebook. /// </summary> /// <param name="dateToConvert">The date that we need to pass to the api.</param> /// <returns>The number of seconds since Jan 1, 1970.</returns> internal static double ConvertDateToDouble(DateTime dateToConvert) { double result; DateTime utcDate = new DateTime(1970, 1, 1, 0, 0, 0); TimeSpan span = dateToConvert - utcDate; result = span.Seconds; return result; } }