コード例 #1
0
        public static DateTime NSDateToDateTime(MonoTouch.Foundation.NSDate date)
        {
            var nsDateNow = (DateTime)NSDate.Now;
            var diff      = DateTime.Now.Subtract(nsDateNow);
            var newDate   = ((DateTime)date).Add(diff);

            return(newDate);
            // return (new DateTime(2001,1,1,0,0,0)).AddSeconds(date.SecondsSinceReferenceDate);
        }
コード例 #2
0
        public static DateTime NSDateToDateTime(MonoTouch.Foundation.NSDate date)
        {
            if (date == null)
            {
                return(DateTime.MinValue);
            }
            var theDate = ((DateTime)date).ToLocalTime();

            return(theDate);
        }