Example #1
0
        internal virtual int get(bool utc, int field)
        {
            time.setTimeZone(utc ? Timezone.getTimeZone("GMT") : Timezone.getDefault());
            int i = time.get(field);

            return(field == Calendar.DAY_OF_WEEK ? i - 1 : i);
        }
Example #2
0
        internal virtual void setDate(bool utc, double year, double month, double date)
        {
            time.setTimeZone(utc ? Timezone.getTimeZone("GMT") : Timezone.getDefault());

            if (!Double.IsNaN(year))
            {
                time.set(Calendar.YEAR, (int)year);
            }
            if (!Double.IsNaN(month))
            {
                time.set(Calendar.MONTH, (int)month);
            }
            if (!Double.IsNaN(date))
            {
                time.set(Calendar.DAY_OF_MONTH, (int)date);
            }
        }
Example #3
0
        internal virtual void setTime(bool utc, double hours, double minutes, double seconds, double ms)
        {
            time.setTimeZone(utc ? Timezone.getTimeZone("GMT") : Timezone.getDefault());

            if (!Double.IsNaN(hours))
            {
                time.set(Calendar.HOUR_OF_DAY, (int)hours);
            }
            if (!Double.IsNaN(minutes))
            {
                time.set(Calendar.MINUTE, (int)minutes);
            }
            if (!Double.IsNaN(seconds))
            {
                time.set(Calendar.SECOND, (int)seconds);
            }
            if (!Double.IsNaN(ms))
            {
                time.set(Calendar.MILLISECOND, (int)ms);
            }
        }