public void TestDateTime()
        {
            TimeZoneInfo tziNewYork;

            try
            {
                tziNewYork = TimeZoneConverter.TZConvert.GetTimeZoneInfo("Eastern Standard Time");
            }
            catch
            {
                // Ignore issues with locally installed timezones.
                return;
            }
            var tz = new HaystackTimeZone("New_York");
            HaystackDateTime ts;

            ts = new HaystackDateTime(new DateTime(634429600180690000L), tz);
            VerifyZinc(ts, "2011-06-06T12:26:58.069-05:00 New_York");
            Assert.AreEqual(ts.TimeZone.Name, "New_York");
            Assert.AreEqual(ts.TimeZone.TimeZoneInfo, tziNewYork);

            // convert back to millis
            ts = ZincReader.ReadValue <HaystackDateTime>("2011-06-06T12:26:58.069-04:00 New_York");
            Assert.AreEqual(ts.Value.Ticks, 634429600180690000L);

            // different timezones
            ts = new HaystackDateTime(new DateTime(630850574400000000L), new HaystackTimeZone("New_York"));
            VerifyZinc(ts, "2000-02-02T03:04:00-05:00 New_York");
            ts = new HaystackDateTime(new DateTime(630850754400000000L), new HaystackTimeZone("UTC"));
            VerifyZinc(ts, "2000-02-02T08:04:00Z UTC");
            ts = new HaystackDateTime(new DateTime(630851042400000000L), new HaystackTimeZone("Taipei"));
            VerifyZinc(ts, "2000-02-02T16:04:00+08:00 Taipei");
        }
Beispiel #2
0
 public HaystackDateTimeRange(HaystackDateTime start, HaystackDateTime end)
 {
     Start = start;
     End   = end;
 }