/// <summary> /// 获取增加指定的数值后的干支实例 /// </summary> /// <param name="i">增加的数值</param> /// <returns>干支</returns> public GanZhi Inc(int i) { TianGan t = _tg.Inc(i); DiZhi d = _dz.Inc(i); return(new GanZhi(t, d)); }
/// <summary> /// 取某天的日支 /// </summary> /// <param name="dt">日期</param> /// <returns></returns> private DiZhi GetDayZhi(System.DateTime dt) { System.DateTime dt1 = new System.DateTime(2000, 2, 5, 12, 0, 0, 0);////以2000.2.5为基准 System.DateTime dt2 = new System.DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0); int n = (dt2 - dt1).Days; DiZhi dz = new DiZhi(DiZhiTypes.Si); return(dz.Inc(n)); }
private DiZhi GetDayZhi(DateTime dt) { DateTime time = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0); DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0); TimeSpan span = (TimeSpan)(time2 - time); int days = span.Days; DiZhi zhi = new DiZhi(DiZhiTypes.Si); return(zhi.Inc(days)); }
private DiZhi GetYearDiZhi(int y) { int i = y - 0x7d0; DiZhi zhi = new DiZhi(DiZhiTypes.Chen); if (i == 0) { return(zhi); } return(zhi.Inc(i)); }
/// <summary> /// 取指定公历年的地支 /// </summary> /// <param name="y">年份</param> /// <returns>地支</returns> private DiZhi GetYearDiZhi(int y) { int i = y - 2000;//以2000年为基准 DiZhi dz = new DiZhi(DiZhiTypes.Chen); if (i == 0) { return(dz); } else { return(dz.Inc(i)); } }
private DiZhi GetYearDiZhi(int y) { int i = y - 0x7d0; DiZhi zhi = new DiZhi(DiZhiTypes.Chen); if (i == 0) { return zhi; } return zhi.Inc(i); }
private DiZhi GetDayZhi(DateTime dt) { DateTime time = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0); DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0); TimeSpan span = (TimeSpan) (time2 - time); int days = span.Days; DiZhi zhi = new DiZhi(DiZhiTypes.Si); return zhi.Inc(days); }