Date() public static method

public static Date ( ) : DateType
return DateType
コード例 #1
0
        public void CastToDate(string s, int year, int month, int day)
        {
            var type  = PrimitiveTypes.String();
            var value = new SqlString(s);

            var casted = type.CastTo(value, PrimitiveTypes.Date());

            Assert.IsNotNull(casted);
            Assert.IsInstanceOf <SqlDateTime>(casted);

            var date = (SqlDateTime)casted;

            Assert.AreEqual(year, date.Year);
            Assert.AreEqual(month, date.Month);
            Assert.AreEqual(day, date.Day);
            Assert.AreEqual(0, date.Hour);
            Assert.AreEqual(0, date.Minute);
            Assert.AreEqual(0, date.Second);
            Assert.AreEqual(0, date.Millisecond);
            Assert.AreEqual(SqlDayToSecond.Zero, date.Offset);
        }