Example #1
0
        public static double setMonth(object thisObj, double dmonth,
                                      object date)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject dt = (DateObject)thisObj;
            double     t  = DateConstructor.LocalTime(dt.ms);

            double new_date;

            if (date == null)
            {
                new_date = DateConstructor.DateFromTime(t);
            }
            else
            {
                new_date = Convert.ToNumber(date);
            }

            double day = DateConstructor.MakeDay((double)DateConstructor.YearFromTime(t),
                                                 dmonth, new_date);
            double new_val = DateConstructor.ToUTC(DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY));

            dt.ms = DateConstructor.TimeClip(new_val);
            return(dt.ms);
        }
Example #2
0
        public static double setUTCDate(object thisObj, double ddate)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject date = (DateObject)thisObj;
            double     t    = date.ms;
            double     day  = DateConstructor.MakeDay((double)DateConstructor.YearFromTime(t),
                                                      (double)DateConstructor.MonthFromTime(t), ddate);
            double new_val = DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY);

            date.ms = DateConstructor.TimeClip(new_val);
            return(date.ms);
        }
Example #3
0
        public static double setUTCFullYear(object thisObj, double dyear,
                                            object month, object date)
        {
            SemanticAnalyser.assert_type(thisObj, typeof(DateObject));
            DateObject dt = (DateObject)thisObj;
            double     t  = dt.ms;

            if (Double.IsNaN(t))
            {
                t = 0;
            }

            double new_month;

            if (month == null)
            {
                new_month = DateConstructor.MonthFromTime(t);
            }
            else
            {
                new_month = Convert.ToNumber(month);
            }

            double new_date;

            if (date == null)
            {
                new_date = DateConstructor.DateFromTime(t);
            }
            else
            {
                new_date = Convert.ToNumber(date);
            }

            double day     = DateConstructor.MakeDay(dyear, new_month, new_date);
            double new_val = DateConstructor.MakeDate(day, t % DateConstructor.MS_PER_DAY);

            dt.ms = DateConstructor.TimeClip(new_val);
            return(dt.ms);
        }