Thursday, 12 May 2016

Convert Date time to Unix timestamp

public static long ConvertToUnixTime(DateTime datetime)
{
    DateTime sTime = new DateTime(1970, 1, 1,0,0,0,DateTimeKind.Utc);
 
    return (long)(datetime - sTime).TotalSeconds;
}

No comments:

Post a Comment

Featured post

Getting Started With SOLR

Getting Started with Solr ·           Features o    Hit highlighting o    Auto correction o    Faceted Search o    Multi lan...