示例#1
0
        public static DateVM ToDateVM(this DateTime date)
        {
            var vm = new DateVM
            {
                Year    = date.Year,
                Month   = date.Month,
                Day     = date.Day,
                Hour    = date.Hour,
                Seconds = date.Second,
                Mins    = date.Minute
            };

            return(vm);
        }
示例#2
0
        public static DateVM ToDateVM(this DateTime?date)
        {
            if (date == null)
            {
                return(null);
            }

            var vm = new DateVM
            {
                Year    = date.Value.Year,
                Month   = date.Value.Month,
                Day     = date.Value.Day,
                Hour    = date.Value.Hour,
                Seconds = date.Value.Second,
                Mins    = date.Value.Minute
            };

            return(vm);
        }
示例#3
0
        public static DateTime ToDate(this DateVM vm)
        {
            var date = new DateTime(vm.Year, vm.Month, vm.Day, vm.Hour, vm.Mins, vm.Seconds);

            return(date);
        }
示例#4
0
        public static DateTime ToUTCDate(this DateVM vm)
        {
            var date = new DateTime(vm.Year, vm.Month, vm.Day, vm.Hour, vm.Mins, vm.Seconds);

            return(DateTime.SpecifyKind(date, DateTimeKind.Utc));
        }