Ejemplo n.º 1
0
        public void DatetimeStaticPropertiesAndMethods()
        {
            Assert.DoesNotThrow(() =>
            {
                var now    = Datetime.now();
                var notNow = Datetime.newInstance(now.year() + 1, (now.month() + 1) % 12, (now.day() + 1) % 28);

                var then = Datetime.newInstance(1970, 12, 11, 10, 9, 8);
                Assert.AreEqual(1970, then.year());
                Assert.AreEqual(12, then.month());
                Assert.AreEqual(11, then.day());
                Assert.AreEqual(10, then.hour());
                Assert.AreEqual(9, then.minute());
                Assert.AreEqual(8, then.second());

                var parsed = Datetime.parse("1970/12/11");
                Assert.AreEqual(1970, parsed.year());
                Assert.AreEqual(12, parsed.month());
                Assert.AreEqual(11, parsed.day());
            });
        }