/// <summary> /// 创建日期数据 /// </summary> public static DateData createByTimeSeconds(long timeSeconds) { DateData re = new DateData(); re.initByTimeSeconds(timeSeconds); return(re); }
/** 写入时间字符串表示(ms),onlyDay仅仅需要显示到天 */ public static void writeTimeStr(StringBuilder sb, long time, bool onlyDay = false) { DateData date = new DateData(); date.initByTimeMillis(time); date.writeToStringBuilder(sb, onlyDay); }
/** 获取下一个cron时刻(ms) */ public static DateData getNextCronDate(string cron, DateData data) { DateData date = new DateData(); date.initByTimeMillis(getNextCronTime(cron, data.getTimeMillis())); return(date); }
/// <summary> /// 克隆 /// </summary> public DateData cloneDate() { DateData re = new DateData(); re.timeSeconds = this.timeSeconds; re._timeDirty = true; return(re); }
/// <summary> /// 获取缓存日期(1帧一变) /// </summary> public static DateData getNatureNow() { DateTime d = DateTime.Now; DateData date = new DateData(); date.initByDateTime(d); return(date); }
/** 获取当前日期 */ public static DateData getNow() { DateTime dt = DateTime.Now; DateData data = new DateData(); data.initByDateTime(dt); return(data); }
/// <summary> /// 复制(深拷贝) /// </summary> protected override void toCopy(BaseData data) { if (!(data is DateData)) { return; } DateData mData = (DateData)data; this.timeSeconds = mData.timeSeconds; }
/// <summary> /// 是否数据一致 /// </summary> protected override bool toDataEquals(BaseData data) { DateData mData = (DateData)data; if (this.timeSeconds != mData.timeSeconds) { return(false); } return(true); }
/// <summary> /// 是否和此日期相等 /// </summary> public bool equalsDate(DateData data) { return(this.timeSeconds > data.timeSeconds); }
/// <summary> /// 是否在此日期后 /// </summary> public bool after(DateData data) { return(this.timeSeconds > data.timeSeconds); }
/// <summary> /// 是否在此日期前 /// </summary> public bool before(DateData data) { return(this.timeSeconds < data.timeSeconds); }