/// <summary> ///time stamp to C # format time/// </summary> /// <param name= "TimeStamp" ></param> /// <param name= "Bflag" >gets a 10-bit timestamp when true, and a 13-bit timestamp for false.</param> /// <returns></returns> PrivateDateTime GetTime (stringTimeStamp,BOOLBflag =true) {DateTime Dtstart= TimeZone.CurrentTimeZone.ToLocalTime (NewDateTime (1970,1,1)); LongLtime; if(bflag==true) {Ltime=Long. Parse (TimeStamp +"0000000"); } Else{ltime=Long. Parse (TimeStamp +"0000"); } TimeSpan Tonow=NewTimeSpan (Ltime);returnDtstart.add (Tonow); }
/// <summary> ///gets the current time stamp/// </summary> /// <param name= "Bflag" >gets a 10-bit timestamp when true, and a 13-bit timestamp for false.</param> /// <returns></returns> Public Static stringGettimestamp (BOOLBflag =true) {TimeSpan TS= Datetime.utcnow-NewDateTime (1970,1,1,0,0,0,0); stringRET =string. Empty; if(bflag) RET=Convert.toint64 (TS. totalseconds). ToString (); Elseret=Convert.toint64 (TS. TotalMilliseconds). ToString (); returnret; }
C # Timestamp Turn time-time-to-time stamp