コード例 #1
0
        public void AsDateHourMinSecTest1()
        {
            string expected = "20140225083022+0800";
            string actual;

            //actual = DateTimeTools.ConvertDateTimeOffsetToString.AsDateHourMinSec(oDateTimeOffSet.ToOffset(new TimeSpan(+8,0,0)), true);
            actual = DateTimeSupportTools.AsString(oDateTimeOffSet.ToOffset(new TimeSpan(+8, 0, 0)), true, DateTimeSupportTools.DateTimePrecision.DateHourMinSec);
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void AsDateHourMinSecTest()
        {
            string expected = "20140225103022";
            string actual;

            //actual = DateTimeTools.ConvertDateTimeOffsetToString.AsDateHourMinSec(oDateTimeOffSet);
            actual = DateTimeSupportTools.AsString(oDateTimeOffSet, false, DateTimeSupportTools.DateTimePrecision.DateHourMinSec);
            Assert.AreEqual(expected, actual);
        }
        public void AsDateTimeTest()
        {
            string         HL7StandardDateTimeString = "20140225083022.5190+0800";
            DateTimeOffset expected = new DateTimeOffset(2014, 02, 25, 08, 30, 22, 519, new TimeSpan(+8, 0, 0));
            DateTimeOffset actual;

            //actual = DateTimeTools.ConvertStringToDateTime.AsDateTimeOffset(HL7StandardDateTimeString);
            actual = DateTimeSupportTools.AsDateTimeOffSet(HL7StandardDateTimeString);
            Assert.AreEqual(expected, actual);
        }
コード例 #4
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Returns the HL7 DateTime string set with the timezone and Precision given
 /// </summary>
 /// <param name="WithTimezone"></param>
 /// <param name="WithPrecision"></param>
 /// <returns></returns>
 public string AsString(bool WithTimezone, DateTimeSupportTools.DateTimePrecision WithPrecision)
 {
     return(DateTimeSupportTools.AsString(DateTimeSupportTools.AsDateTimeOffSet(_ContentBase.AsString), WithTimezone, WithPrecision));
 }
コード例 #5
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Sets the HL7 DateTime string from the given DateTimeOffset.
 /// Will also set the HL7 dateTime timezone if 'HasTimezone' is set to true [Defaults to True.
 /// Will set the HL7 dateTime string Precision to the 'DateTimePrecision' given [Defaults to DateHourMinSec].
 /// </summary>
 /// <param name="DateTimeOffset"></param>
 /// <param name="HasTimezone"></param>
 /// <param name="DateTimePrecision"></param>
 public void SetDateTimeOffset(DateTimeOffset DateTimeOffset, bool HasTimezone = true, DateTimeSupportTools.DateTimePrecision DateTimePrecision = DateTimeSupportTools.DateTimePrecision.DateHourMinSec)
 {
     _ContentBase.AsString = DateTimeSupportTools.AsString(DateTimeOffset, HasTimezone, DateTimePrecision);
 }
コード例 #6
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Returns a DateTimeOffset if the HL7 datetime string can be parsed as a DateTimeOffset.
 /// Throws a FormatException if the HL7 datetime string can not be parsed.
 /// </summary>
 /// <returns></returns>
 public DateTimeOffset GetDateTimeOffset()
 {
     return(DateTimeSupportTools.AsDateTimeOffSet(_ContentBase.AsString));
 }
コード例 #7
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Get the precision of the HL7 Datetime string
 /// Returns None if the string is not a HL7 datetime string of empty
 /// </summary>
 /// <returns></returns>
 public DateTimeSupportTools.DateTimePrecision GetPrecision()
 {
     return(DateTimeSupportTools.GetPrecision(_ContentBase.AsString));
 }
コード例 #8
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Set the time-zone for a give HL7 DateTime. This will convert the date time from the time zone present to the new timezone.
 /// If no time zone is present in the HL7 date time string then it will assume that this date time is from the new timezone and not convert.
 /// </summary>
 /// <param name="Timespan"></param>
 public void SetTimezone(TimeSpan Timespan)
 {
     _ContentBase.AsString = DateTimeSupportTools.SetTimezone(_ContentBase.AsString, Timespan);
 }
コード例 #9
0
ファイル: DateTime.cs プロジェクト: shankargmr/PeterPiper
 /// <summary>
 /// Returns a TimeSpan equal to the time-zone found in the HL7 DateTime string.
 /// Throws a formatException if no time-zone is present, please test with 'HasTimezone' before calling.
 /// </summary>
 /// <returns>HL7 string representation of the time-zone</returns>
 public TimeSpan GetTimezone()
 {
     return(DateTimeSupportTools.GetTimezone(_ContentBase.AsString));
 }