public static Dynastream.Fit.DateTime ToLocalDateTime(Dynastream.Fit.DateTime dt) { DateTime dateTime = dt.GetDateTime(); DateTime lDateTime = dateTime.ToLocalTime(); return(new Dynastream.Fit.DateTime(lDateTime)); }
public static DateTime ToLocalDateTime(uint timeStamp) { Dynastream.Fit.DateTime dt = new Dynastream.Fit.DateTime(timeStamp); DateTime dt1 = dt.GetDateTime(); return(dt1.ToLocalTime()); }
/// <summary> /// constructor /// </summary> public TcxLap(string dateTimeString) { // init list of tracks this.tracks = new List <TcxTrack>(); // init fields this.startTime = TcxUtility.ToFitTime(dateTimeString); this.timestamp = this.startTime.GetTimeStamp(); }
public void ToFitTime_Test_Pass() { string dateTimeString = "2017-11-27T12:16:30.000Z"; SysDateTime actual = new SysDateTime(2017, 11, 27, 12, 16, 30, DateTimeKind.Utc); DateTime dateTime = TcxUtility.ToFitTime(dateTimeString); Assert.AreEqual(dateTime.GetDateTime(), actual); }
/// <summary> /// Constructor /// </summary> /// <param name="dateTimeString"></param> public TcxActivity(string dateTimeString) { // create new List of laps this.laps = new List <TcxLap>(); // init fields this.id = TcxUtility.ToFitTime(dateTimeString); this.timestamp = TcxUtility.ToFitTime(dateTimeString).GetTimeStamp(); this.LocalTimestamp = this.Timestamp; }
public void ToFitTime_Test_FailDueToConvertException() { string dateTimeString = ""; DateTime dateTime = null; try { dateTime = TcxUtility.ToFitTime(dateTimeString); } catch { Assert.Fail(); Assert.AreEqual(dateTime, null); } }
/// <summary> /// Convert string to time /// </summary> /// <param name="dateTimeString">will be in a format of yyyy-mm-ddThh:mm:ss.000z</param> /// <returns></returns> public static DateTime ToFitTime(string dateTimeString) { //dateTimeString = dateTimeString.Replace("000Z", "0000000Z"); try { // format can be "o" SysDateTime sysDateTime = SysDateTime.ParseExact(dateTimeString, "yyyy-MM-dd'T'HH:mm:ss.fff'Z'", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind); DateTime dateTime = new DateTime(sysDateTime); return(dateTime); } catch (Exception e) { Console.WriteLine("{0} is not in the correct format.", dateTimeString); Console.WriteLine(e.Message); } return(null); }
public DateTime(Dynastream.Fit.DateTime dateTime) : this(dateTime.GetTimeStamp(), dateTime.GetFractionalTimeStamp()) { }