`
will-vip
  • 浏览: 40917 次
  • 性别: Icon_minigender_1
  • 来自: 广州
文章分类
社区版块
存档分类
最新评论

JAVA版农历和阳历相互转换源码

阅读更多
JAVA版农历和阳历相互转换源码

public class TestNongLi ...{
  public static void main(String[] args) ...{
    // 调用农历日期转换阳历日期方法
    System.out.println(ChineseCalendar.sCalendarLundarToSolar(2008, 1, 1));
  }
}

// 自定义日历类
class ChineseCalendar ...{

  // Array lIntLunarDay is stored in the monthly day information in every year from 1901 to 2100 of the lunar calendar,
  // The lunar calendar can only be 29 or 30 days every month, express with 12(or 13) pieces of binary bit in one year,
  // it is 30 days for 1 form in the corresponding location , otherwise it is 29 days
  private static final int[] iLunarMonthDaysTable = ...{ 0x4ae0, 0xa570, 0x5268, 0xd260, 0xd950, 0x6aa8, 0x56a0, 0x9ad0, 0x4ae8,
      0x4ae0, // 1910
      0xa4d8, 0xa4d0, 0xd250, 0xd548, 0xb550, 0x56a0, 0x96d0, 0x95b0, 0x49b8, 0x49b0, // 1920
      0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada8, 0x2b60, 0x9570, 0x4978, 0x4970, 0x64b0, // 1930
      0xd4a0, 0xea50, 0x6d48, 0x5ad0, 0x2b60, 0x9370, 0x92e0, 0xc968, 0xc950, 0xd4a0, // 1940
      0xda50, 0xb550, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, 0xb4a8, 0x6ca0, // 1950
      0xb550, 0x55a8, 0x4da0, 0xa5b0, 0x52b8, 0x52b0, 0xa950, 0xe950, 0x6aa0, 0xad50, // 1960
      0xab50, 0x4b60, 0xa570, 0xa570, 0x5260, 0xe930, 0xd950, 0x5aa8, 0x56a0, 0x96d0, // 1970
      0x4ae8, 0x4ad0, 0xa4d0, 0xd268, 0xd250, 0xd528, 0xb540, 0xb6a0, 0x96d0, 0x95b0, // 1980
      0x49b0, 0xa4b8, 0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada0, 0xab60, 0x9370, 0x4978, // 1990
      0x4970, 0x64b0, 0x6a50, 0xea50, 0x6b28, 0x5ac0, 0xab60, 0x9368, 0x92e0, 0xc960, // 2000
      0xd4a8, 0xd4a0, 0xda50, 0x5aa8, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, // 2010
      0xb4a0, 0xb550, 0xb550, 0x55a8, 0x4ba0, 0xa5b0, 0x52b8, 0x52b0, 0xa930, 0x74a8, // 2020
      0x6aa0, 0xad50, 0x4da8, 0x4b60, 0x9570, 0xa4e0, 0xd260, 0xe930, 0xd530, 0x5aa0, // 2030
      0x6b50, 0x96d0, 0x4ae8, 0x4ad0, 0xa4d0, 0xd258, 0xd250, 0xd520, 0xdaa0, 0xb5a0, // 2040
      0x56d0, 0x4ad8, 0x49b0, 0xa4b8, 0xa4b0, 0xaa50, 0xb528, 0x6d20, 0xada0, 0x55b0 // 2050
  };

  // Array iLunarLeapMonthTable preserves the lunar calendar leap month from 1901 to 2050,
  // if it is 0 express not to have , every byte was stored for two years
  private static final char[] iLunarLeapMonthTable = ...{ 0x00, 0x50, 0x04, 0x00, 0x20, // 1910
      0x60, 0x05, 0x00, 0x20, 0x70, // 1920
      0x05, 0x00, 0x40, 0x02, 0x06, // 1930
      0x00, 0x50, 0x03, 0x07, 0x00, // 1940
      0x60, 0x04, 0x00, 0x20, 0x70, // 1950
      0x05, 0x00, 0x30, 0x80, 0x06, // 1960
      0x00, 0x40, 0x03, 0x07, 0x00, // 1970
      0x50, 0x04, 0x08, 0x00, 0x60, // 1980
      0x04, 0x0a, 0x00, 0x60, 0x05, // 1990
      0x00, 0x30, 0x80, 0x05, 0x00, // 2000
      0x40, 0x02, 0x07, 0x00, 0x50, // 2010
      0x04, 0x09, 0x00, 0x60, 0x04, // 2020
      0x00, 0x20, 0x60, 0x05, 0x00, // 2030
      0x30, 0xb0, 0x06, 0x00, 0x50, // 2040
      0x02, 0x07, 0x00, 0x50, 0x03 // 2050
  };

  // Array iSolarLunarTable stored the offset days
  // in New Year of solar calendar and lunar calendar from 1901 to 2050;
  private static final char[] iSolarLunarOffsetTable = ...{ 49, 38, 28, 46, 34, 24, 43, 32, 21, 40, // 1910
      29, 48, 36, 25, 44, 34, 22, 41, 31, 50, // 1920
      38, 27, 46, 35, 23, 43, 32, 22, 40, 29, // 1930
      47, 36, 25, 44, 34, 23, 41, 30, 49, 38, // 1940
      26, 45, 35, 24, 43, 32, 21, 40, 28, 47, // 1950
      36, 26, 44, 33, 23, 42, 30, 48, 38, 27, // 1960
      45, 35, 24, 43, 32, 20, 39, 29, 47, 36, // 1970
      26, 45, 33, 22, 41, 30, 48, 37, 27, 46, // 1980
      35, 24, 43, 32, 50, 39, 28, 47, 36, 26, // 1990
      45, 34, 22, 40, 30, 49, 37, 27, 46, 35, // 2000
      23, 42, 31, 21, 39, 28, 48, 37, 25, 44, // 2010
      33, 23, 41, 31, 50, 39, 28, 47, 35, 24, // 2020
      42, 30, 21, 40, 28, 47, 36, 25, 43, 33, // 2030
      22, 41, 30, 49, 37, 26, 44, 33, 23, 42, // 2040
      31, 21, 40, 29, 47, 36, 25, 44, 32, 22, // 2050
  };

  static boolean bIsSolarLeapYear(int iYear) ...{
    return ((iYear % 4 == 0) && (iYear % 100 != 0) || iYear % 400 == 0);
  }

  // The days in the month of solar calendar
  static int iGetSYearMonthDays(int iYear, int iMonth) ...{
    if ((iMonth == 1) || (iMonth == 3) || (iMonth == 5) || (iMonth == 7) || (iMonth == || (iMonth == 10) || (iMonth == 12))
      return 31;
    else if ((iMonth == 4) || (iMonth == 6) || (iMonth == 9) || (iMonth == 11))
      return 30;
    else if (iMonth == 2) ...{
      if (bIsSolarLeapYear(iYear))
        return 29;
      else
        return 28;
    } else
      return 0;
  }

  // The offset days from New Year and the day when point out in solar calendar
  static int iGetSNewYearOffsetDays(int iYear, int iMonth, int iDay) ...{
    int iOffsetDays = 0;

    for (int i = 1; i < iMonth; i++) ...{
      iOffsetDays += iGetSYearMonthDays(iYear, i);
    }
    iOffsetDays += iDay - 1;

    return iOffsetDays;
  }

  static int iGetLLeapMonth(int iYear) ...{
    char iMonth = iLunarLeapMonthTable[(iYear - 1901) / 2];

    if (iYear % 2 == 0)
      return (iMonth & 0x0f);
    else
      return (iMonth & 0xf0) >> 4;
  }

  static int iGetLMonthDays(int iYear, int iMonth) ...{
    int iLeapMonth = iGetLLeapMonth(iYear);
    if ((iMonth > 12) && (iMonth - 12 != iLeapMonth) || (iMonth < 0)) ...{
      System.out.println("Wrong month, ^_^ , i think you are want a -1, go to death!");
      return -1;
    }
    if (iMonth - 12 == iLeapMonth) ...{
      if ((iLunarMonthDaysTable[iYear - 1901] & (0x8000 >> iLeapMonth)) == 0)
        return 29;
      else
        return 30;
    }
    if ((iLeapMonth > 0) && (iMonth > iLeapMonth))
      iMonth++;
    if ((iLunarMonthDaysTable[iYear - 1901] & (0x8000 >> (iMonth - 1))) == 0)
      return 29;
    else
      return 30;
  }

  // Days in this year of lunar calendar
  static int iGetLYearDays(int iYear) ...{
    int iYearDays = 0;
    int iLeapMonth = iGetLLeapMonth(iYear);

    for (int i = 1; i < 13; i++)
      iYearDays += iGetLMonthDays(iYear, i);
    if (iLeapMonth > 0)
      iYearDays += iGetLMonthDays(iYear, iLeapMonth + 12);
    return iYearDays;
  }

  static int iGetLNewYearOffsetDays(int iYear, int iMonth, int iDay) ...{
    int iOffsetDays = 0;
    int iLeapMonth = iGetLLeapMonth(iYear);

    if ((iLeapMonth > 0) && (iLeapMonth == iMonth - 12)) ...{
      iMonth = iLeapMonth;
      iOffsetDays += iGetLMonthDays(iYear, iMonth);
    }

    for (int i = 1; i < iMonth; i++) ...{
      iOffsetDays += iGetLMonthDays(iYear, i);
      if (i == iLeapMonth)
        iOffsetDays += iGetLMonthDays(iYear, iLeapMonth + 12);
    }
    iOffsetDays += iDay - 1;

    return iOffsetDays;
  }

  // The solar calendar is turned into the lunar calendar
  static String sCalendarSolarToLundar(int iYear, int iMonth, int iDay) ...{
    int iLDay, iLMonth, iLYear;
    int iOffsetDays = iGetSNewYearOffsetDays(iYear, iMonth, iDay);
    int iLeapMonth = iGetLLeapMonth(iYear);

    if (iOffsetDays < iSolarLunarOffsetTable[iYear - 1901]) ...{
      iLYear = iYear - 1;
      iOffsetDays = iSolarLunarOffsetTable[iYear - 1901] - iOffsetDays;
      iLDay = iOffsetDays;

      for (iLMonth = 12; iOffsetDays > iGetLMonthDays(iLYear, iLMonth); iLMonth--) ...{
        iLDay = iOffsetDays;
        iOffsetDays -= iGetLMonthDays(iLYear, iLMonth);
      }
      if (0 == iLDay)
        iLDay = 1;
      else
        iLDay = iGetLMonthDays(iLYear, iLMonth) - iOffsetDays + 1;
    } else ...{
      iLYear = iYear;
      iOffsetDays -= iSolarLunarOffsetTable[iYear - 1901];
      iLDay = iOffsetDays + 1;

      for (iLMonth = 1; iOffsetDays >= 0; iLMonth++) ...{
        iLDay = iOffsetDays + 1;
        iOffsetDays -= iGetLMonthDays(iLYear, iLMonth);
        if ((iLeapMonth == iLMonth) && (iOffsetDays > 0)) ...{
          iLDay = iOffsetDays;
          iOffsetDays -= iGetLMonthDays(iLYear, iLMonth + 12);
          if (iOffsetDays <= 0) ...{
            iLMonth += 12 + 1;
            break;
          }
        }
      }
      iLMonth--;
    }
    return "" + iLYear + (iLMonth > 9 ? "" + iLMonth : "0" + iLMonth) + (iLDay > 9 ? "" + iLDay : "0" + iLDay);
  }

  // The lunar calendar is turned into the Solar calendar
  static String sCalendarLundarToSolar(int iYear, int iMonth, int iDay) ...{
    int iSYear, iSMonth, iSDay;
    int iOffsetDays = iGetLNewYearOffsetDays(iYear, iMonth, iDay) + iSolarLunarOffsetTable[iYear - 1901];
    int iYearDays = bIsSolarLeapYear(iYear) ? 366 : 365;

    if (iOffsetDays >= iYearDays) ...{
      iSYear = iYear + 1;
      iOffsetDays -= iYearDays;
    } else ...{
      iSYear = iYear;
    }
    iSDay = iOffsetDays + 1;
    for (iSMonth = 1; iOffsetDays >= 0; iSMonth++) ...{
      iSDay = iOffsetDays + 1;
      iOffsetDays -= iGetSYearMonthDays(iSYear, iSMonth);
    }
    iSMonth--;

    return "" + iSYear + (iSMonth > 9 ? iSMonth + "" : "0" + iSMonth) + (iSDay > 9 ? iSDay + "" : "0" + iSDay);
  }
}

// 自定义星期类
class Week ...{
  int iWeek;

  private String sWeek[] = ...{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };

  public Week() ...{
    iWeek = 0;
  }

  public Week(int w) ...{
    if ((w > 6) || (w < 0)) ...{
      System.out.println("Week out of range, I think you want Sunday");
      this.iWeek = 0;
    } else
      this.iWeek = w;
  }

  public String toString() ...{
    return sWeek[iWeek];
  }
}

// 自定义日期类
class MyDate ...{

  public int iYear;

  public int iMonth;

  public int iDay;

  private static int checkYear(int iYear) ...{
    if ((iYear > 1901) && (iYear < 2050))
      return iYear;
    else ...{
      System.out.println("The Year out of range, I think you want 1981");
      return 1981;
    }
  }

  public MyDate(int iYear, int iMonth, int iDay) ...{
    this.iYear = checkYear(iYear);
    this.iMonth = iMonth;
    this.iDay = iDay;
  }

  public MyDate(int iYear, int iMonth) ...{
    this.iYear = checkYear(iYear);
    this.iMonth = iMonth;
    this.iDay = 1;
  }

  public MyDate(int iYear) ...{
    this.iYear = checkYear(iYear);
    this.iMonth = 1;
    this.iDay = 1;
  }

  public MyDate() ...{
    this.iYear = 1981;
    this.iMonth = 1;
    this.iDay = 1;
  }

  public String toString() ...{
    return "" + this.iYear + (this.iMonth > 9 ? "" + this.iMonth : "0" + this.iMonth)
        + (this.iDay > 9 ? "" + this.iDay : "0" + this.iDay);
  }

  public boolean equals(MyDate md) ...{
    return ((md.iDay == this.iDay) && (md.iMonth == this.iMonth) && (md.iYear == this.iYear));
  }
}

// 阳历日期类,继承自定义日期
class SolarDate extends MyDate ...{

  private static int checkMonth(int iMonth) ...{
    if (iMonth > 12) ...{
      System.out.println("Month out of range, I think you want 12 ");
      return 12;
    } else if (iMonth < 1) ...{
      System.out.println("Month out of range, I think you want 1 ");
      return 1;
    } else
      return iMonth;
  }

  private static int checkDay(int iYear, int iMonth, int iDay) ...{
    int iMonthDays = ChineseCalendar.iGetSYearMonthDays(iYear, iMonth);

    if (iDay > iMonthDays) ...{
      System.out.println("Day out of range, I think you want " + iMonthDays + " ");
      return iMonthDays;
    } else if (iDay < 1) ...{
      System.out.println("Day out of range, I think you want 1 ");
      return 1;
    } else
      return iDay;
  }

  public SolarDate(int iYear, int iMonth, int iDay) ...{
    super(iYear);
    this.iMonth = checkMonth(iMonth);
    this.iDay = checkDay(this.iYear, this.iMonth, iDay);
  }

  public SolarDate(int iYear, int iMonth) ...{
    super(iYear);
    this.iMonth = checkMonth(iMonth);
  }

  public SolarDate(int iYear) ...{
    super(iYear);
  }

  public SolarDate() ...{
    super();
  }

  public String toString() ...{
    return "" + this.iYear + (this.iMonth > 9 ? "-" + this.iMonth : "-0" + this.iMonth)
        + (this.iDay > 9 ? "-" + this.iDay : "-0" + this.iDay);
  }

  public Week toWeek() ...{
    int iOffsetDays = 0;
    for (int i = 1901; i < iYear; i++) ...{
      if (ChineseCalendar.bIsSolarLeapYear(i))
        iOffsetDays += 366;
      else
        iOffsetDays += 365;
    }

    iOffsetDays += ChineseCalendar.iGetSNewYearOffsetDays(iYear, iMonth, iDay);
    return new Week((iOffsetDays + 2) % 7);
  }

  public LunarDate toLunarDate() ...{
    int iYear, iMonth, iDay, iDate;
    LunarDate ld;
    iDate = Integer.parseInt(ChineseCalendar.sCalendarSolarToLundar(this.iYear, this.iMonth, this.iDay));
    iYear = iDate / 10000;
    iMonth = iDate % 10000 / 100;
    iDay = iDate % 100;
    ld = new LunarDate(iYear, iMonth, iDay);
    return ld;
  }
}

// 阴历日期类,继承自定义日期类
class LunarDate extends MyDate ...{

  private String sChineseNum[] = ...{ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十" };

  private static int checkMonth(int iYear, int iMonth) ...{
    if ((iMonth > 12) && (iMonth == ChineseCalendar.iGetLLeapMonth(iYear) + 12)) ...{
      return iMonth;
    } else if (iMonth > 12) ...{
      System.out.println("Month out of range, I think you want 12 ");
      return 12;
    } else if (iMonth < 1) ...{
      System.out.println("Month out of range, I think you want 1 ");
      return 1;
    } else
      return iMonth;
  }

  private static int checkDay(int iYear, int iMonth, int iDay) ...{
    int iMonthDays = ChineseCalendar.iGetLMonthDays(iYear, iMonth);

    if (iDay > iMonthDays) ...{
      System.out.println("Day out of range, I think you want " + iMonthDays + " ");
      return iMonthDays;
    } else if (iDay < 1) ...{
      System.out.println("Day out of range, I think you want 1 ");
      return 1;
    } else
      return iDay;
  }

  public LunarDate(int iYear, int iMonth, int iDay) ...{
    super(iYear);
    this.iMonth = checkMonth(this.iYear, iMonth);
    this.iDay = checkDay(this.iYear, this.iMonth, iDay);
  }

  public LunarDate(int iYear, int iMonth) ...{
    super(iYear);
    this.iMonth = checkMonth(this.iYear, iMonth);
  }

  public LunarDate(int iYear) ...{
    super(iYear);
  }

  public LunarDate() ...{
    super();
  }

  public String toString() ...{
    String sCalendar = "农历";

    sCalendar += sChineseNum[iYear / 1000] + sChineseNum[iYear % 1000 / 100] + sChineseNum[iYear % 100 / 10]
        + sChineseNum[iYear % 10] + "(" + toChineseEra() + ")年";
    if (iMonth > 12) ...{
      iMonth -= 12;
      sCalendar += "闰";
    }
    if (iMonth == 12)
      sCalendar += "腊月";
    else if (iMonth == 11)
      sCalendar += "冬月";
    else if (iMonth == 1)
      sCalendar += "正月";
    else
      sCalendar += sChineseNum[iMonth] + "月";
    if (iDay > 29)
      sCalendar += "三十";
    else if (iDay > 20)
      sCalendar += "二十" + sChineseNum[iDay % 20];
    else if (iDay == 20)
      sCalendar += "二十";
    else if (iDay > 10)
      sCalendar += "十" + sChineseNum[iDay % 10];
    else
      sCalendar += "初" + sChineseNum[iDay];

    return sCalendar;
  }

  public CnWeek toWeek() ...{
    int iOffsetDays = 0;
    for (int i = 1901; i < iYear; i++)
      iOffsetDays += ChineseCalendar.iGetLYearDays(i);

    iOffsetDays += ChineseCalendar.iGetLNewYearOffsetDays(iYear, iMonth, iDay);
    return new CnWeek((iOffsetDays + 2) % 7);
  }

  public ChineseEra toChineseEra() ...{
    return new ChineseEra(iYear);
  }

  public SolarDate toSolarDate() ...{
    int iYear, iMonth, iDay, iDate;
    SolarDate sd;
    iDate = Integer.parseInt(ChineseCalendar.sCalendarLundarToSolar(this.iYear, this.iMonth, this.iDay));
    iYear = iDate / 10000;
    iMonth = iDate % 10000 / 100;
    iDay = iDate % 100;
    sd = new SolarDate(iYear, iMonth, iDay);
    return sd;
  }
}

class CnWeek extends Week ...{

  private String sCnWeek[] = ...{ "日", "一", "二", "三", "四", "五", "六" };

  public CnWeek() ...{
    super();
  }

  public CnWeek(int iWeek) ...{
    super(iWeek);
  }

  public String toString() ...{
    return "星期" + sCnWeek[this.iWeek];
  }
}

class ChineseEra ...{
  int iYear;

  String[] sHeavenlyStems = ...{ "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };

  String[] sEarthlyBranches = ...{ "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };

  public ChineseEra() ...{
    int iYear = 1981;
  }

  public ChineseEra(int iYear) ...{
    if ((iYear < 2050) && (iYear > 1901))
      this.iYear = iYear;
    else
      this.iYear = 1981;
  }

  public String toString() ...{
    int temp;
    temp = Math.abs(iYear - 1924);
    return sHeavenlyStems[temp % 10] + sEarthlyBranches[temp % 12];
  }
}

//转载网址:http://blog.csdn.net/junli0310/archive/2008/02/26/2121347.aspx
分享到:
评论

相关推荐

    一个比较综合的阴历和阳历转换的java源程序

    ### 阴历与阳历转换的Java源程序解析 #### 概述 本文将深入探讨一份关于阴历(农历)与阳历(公历)转换的Java源代码,这份代码不仅提供了两种历法之间的相互转换功能,还包含了丰富的节日信息,以及用户友好的...

    阴历阳历相互转换程序源代码

    c语言,阴历阳历相互转换程序源代码。旨在学习c语言。

    阴阳历转换软件源码,实现阴阳历之间的转换

    阴阳历转换是中华文化中常见的日历转换问题,因为中国传统的农历(阴历)与国际通用的公历(阳历)之间存在差异。源码的实现可以帮助开发者理解和应用这类转换。 首先,我们要理解阴阳历的特点。阳历,也就是公历,...

    java源程序-阴历和阳历

    在Java编程语言中,开发一个能够处理阴历和阳历转换的程序是一项有趣且具有挑战性的任务。这个名为“java源程序-阴历和阳历”的项目似乎是一个2008年的beta版本,旨在提供从1900年到2049年间的完整农历数据。下面将...

    C# winform 阴历与阳历之间相互转化

    本项目涉及的核心知识点是C#语言和WinForm框架下实现阴历与阳历之间的转换,这在很多文化传统应用中非常实用,比如在中国,农历(阴历)与公历(阳历)的转换经常被用于节日和纪念日的计算。下面我们将详细讨论相关...

    Delphi实现生肖计算阴阳历的转换源码.rar_Solar_delphi 生肖_delphi源码_生肖

    这个压缩包文件"Delphi实现生肖计算阴阳历的转换源码.rar"包含了一组Delphi源码,专门用于处理中国古代的农历(阴历)与现代公历(阳历)之间的转换,并涉及到生肖计算的功能。源码的实现对于理解日期和时间的处理,...

    阳历转阴历源码

    本篇文章将深入探讨如何在PB(PowerBuilder)环境下实现阳历转阴历的功能,并解析提供的`calendar.dll`和`calendar.pbl`两个文件可能包含的源码知识。 首先,`calendar.dll`是一个动态链接库文件,通常用于封装特定...

    ruby 阳历农历转换类

    2. **农历日期计算**:农历日期的计算涉及农历月份的天数、闰月规则以及农历与阳历的相互转换。 3. **农历到阳历的转换**:此转换需要用到农历的年、月、日信息,结合农历到阳历的转换公式,计算出对应的阳历日期。...

    农历/阳历转换程序

    在农历和阳历转换的过程中,可能会用到以下算法和概念: 1. 天文历法:理解农历和阳历的基本规则,如月份的计算、闰年的判断、节气的确定等。 2. 数学运算:日期之间的转换往往涉及加减乘除,可能还包括模运算(取余...

    WPF日历阴历转换源码

    9. **阴历阳历转换.v12.suo**:这是一个隐藏的用户特定选项文件,存储了Visual Studio的用户设置和调试信息,不直接影响程序运行。 在实际开发中,这个项目可能利用了.NET Framework的DateTime结构和自定义算法来...

    阴历阳历转换器 1.0.rar

    阴历阳历转换器是基于WPF开发的日历阴历阳历转换程序。菜单功能:运行后,选择日期时间,点击 阴历〉〉〉阳历 即可在结果中显示转换结果注意事项:开发环境为Visual Studio 2013,使用.net 4.5开发。

    阴阳历转换

    本篇文章将深入探讨阴阳历转换的原理,并通过分析提供的`Testnongli.java`和`Lunar.java`源码,来阐述如何在Java中实现这一功能。 首先,我们需要了解阴阳历的基本概念。阳历,即公历,是以地球绕太阳公转一周为...

    农历阳历在线互相转换 1.0.zip

    根据压缩包子文件的文件名称“yanglinonglizhuanhuan”,我们可以推测这是源码文件的名字,可能包含了实现农历阳历转换的主要类或者函数。 综合以上信息,我们可以总结出以下几个知识点: 1. **日期转换算法**:该...

    阴历算法 数据 和源码

    本资料包围绕“阴历算法”这一主题,包含了丰富的数据和源码,旨在帮助开发者深入理解和实现阴阳历转换的计算方法。 1. **阴历和阳历相互转换的算法**: 阴历和阳历的转换是农历算法的核心部分。阳历,即公历,是...

    一个比较综合的阴历和阳历转换的java源程序.pdf

    该Java源程序是一个名为"Simple_Calendar"的阴历和阳历转换应用,主要用于展示从1900年至2049年的日期信息,并且包含了节日功能。程序使用了Java Swing库来构建用户界面,提供了三种不同的外观样式供用户选择。...

    阴阳历转换的源代码

    【阴阳历转换的源代码】是一个关于编程的资源,它提供了将传统中国农历(阴历)与公历(阳历)之间相互转换的功能。源码是程序员之间进行学习、交流和分享的重要工具,通过查看和分析这些源代码,我们可以深入理解...

    万年历源代码(阴历阳历)

    万年历源代码是计算机程序设计领域中一个实用的项目,它涵盖了阳历与阴历的转换和计算,以及中国传统节气的算法。在本文中,我们将深入探讨这些知识点,以便理解和实现自己的万年历系统。 首先,我们要理解阳历和...

    VB农历转换,自编阳历与农历转换程序

    摘要:VB源码,其它类别,日历转换,农历转换 农历转换,自编简单阳历与农历转换小程序,公历与农历之间的日期转换,有节日。菜鸟练手请多多包涵。使用方法,在窗口中先把需要转换的日期即可,选择后会自动在窗口下方...

    一个VB阴历-阳历转换的控件(带实例)

    标题中的“一个VB阴历-阳历转换的控件(带实例)”表明这是一个Visual Basic (VB)开发的控件,其主要功能是实现农历与公历之间的转换。控件在编程环境中通常作为用户界面元素,提供特定的功能,但在这个案例中,它...

    公历农历转换C++源码

    在提供的压缩包文件中,"代码中国.txt"可能包含了关于公历农历转换算法的详细说明或源码注释,而"57578863公历(阳历)和农历(阴历)相互转换"可能是实际的源代码文件。这些资源可以帮助我们理解作者是如何实现这个...

Global site tag (gtag.js) - Google Analytics