C # time and timestamp turn 13 bits each
/// <summary> ///convert C # datetime format to UNIX timestamp format/// </summary> /// <param name= "Time" >Time</param> /// <returns>Long</returns> Public Static LongConvertdatetimetoint (System.DateTime time) {System.DateTime startTime= TimeZone.CurrentTimeZone.ToLocalTime (NewSystem.DateTime (1970,1,1,0,0,0,0)); LongT = (time. Ticks-starttime.ticks)/10000;//except 10000 adjustment for 13 bit returnT; } /// <summary> ///time stamp to C # format time/// </summary> /// <param name= "TimeStamp" ></param> /// <returns></returns> PrivateDateTime Convertstringtodatetime (stringTimeStamp) {DateTime Dtstart= TimeZone.CurrentTimeZone.ToLocalTime (NewDateTime (1970,1,1)); LongLtime =Long. Parse (TimeStamp +"0000"); TimeSpan Tonow=NewTimeSpan (ltime); returnDtstart.add (Tonow); }
Sometimes a 10-bit timestamp is required and can be obtained in the following way
621355968000000000 10000000
Epoch is a long type
C # time Stamp