Example #1
0
        /// <summary>
        /// 创建日期数据
        /// </summary>
        public static DateData createByTimeSeconds(long timeSeconds)
        {
            DateData re = new DateData();

            re.initByTimeSeconds(timeSeconds);
            return(re);
        }
Example #2
0
        /** 写入时间字符串表示(ms),onlyDay仅仅需要显示到天 */
        public static void writeTimeStr(StringBuilder sb, long time, bool onlyDay = false)
        {
            DateData date = new DateData();

            date.initByTimeMillis(time);
            date.writeToStringBuilder(sb, onlyDay);
        }
Example #3
0
        /** 获取下一个cron时刻(ms) */
        public static DateData getNextCronDate(string cron, DateData data)
        {
            DateData date = new DateData();

            date.initByTimeMillis(getNextCronTime(cron, data.getTimeMillis()));

            return(date);
        }
Example #4
0
        /// <summary>
        /// 克隆
        /// </summary>
        public DateData cloneDate()
        {
            DateData re = new DateData();

            re.timeSeconds = this.timeSeconds;
            re._timeDirty  = true;

            return(re);
        }
Example #5
0
        /// <summary>
        /// 获取缓存日期(1帧一变)
        /// </summary>
        public static DateData getNatureNow()
        {
            DateTime d = DateTime.Now;

            DateData date = new DateData();

            date.initByDateTime(d);

            return(date);
        }
Example #6
0
        /** 获取当前日期 */
        public static DateData getNow()
        {
            DateTime dt = DateTime.Now;

            DateData data = new DateData();

            data.initByDateTime(dt);

            return(data);
        }
Example #7
0
        /// <summary>
        /// 复制(深拷贝)
        /// </summary>
        protected override void toCopy(BaseData data)
        {
            if (!(data is DateData))
            {
                return;
            }

            DateData mData = (DateData)data;

            this.timeSeconds = mData.timeSeconds;
        }
Example #8
0
        /// <summary>
        /// 是否数据一致
        /// </summary>
        protected override bool toDataEquals(BaseData data)
        {
            DateData mData = (DateData)data;

            if (this.timeSeconds != mData.timeSeconds)
            {
                return(false);
            }

            return(true);
        }
Example #9
0
 /// <summary>
 /// 是否和此日期相等
 /// </summary>
 public bool equalsDate(DateData data)
 {
     return(this.timeSeconds > data.timeSeconds);
 }
Example #10
0
 /// <summary>
 /// 是否在此日期后
 /// </summary>
 public bool after(DateData data)
 {
     return(this.timeSeconds > data.timeSeconds);
 }
Example #11
0
 /// <summary>
 /// 是否在此日期前
 /// </summary>
 public bool before(DateData data)
 {
     return(this.timeSeconds < data.timeSeconds);
 }