展开全部

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms; namespace BrithdayEigth{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } public static string[] date = { "甲子", "乙丑", "丙寅", "丁卯", "戊辰", "己巳", "庚午", "辛未", "壬申32313133353236313431303231363533e59b9ee7ad9431333365643034", "癸酉", "甲戊", "乙亥", "丙子", "丁丑", "戊寅", "乙卯", "庚辰", "辛巳", "壬午", "癸未", "甲申", "乙酉", "丙戌", "丁亥", "戊子", "己丑", "庚寅", "辛卯", "壬辰", "癸巳", "甲午", "乙未", "丙申", "丁酉", "戊戌", "己亥", "庚子", "辛丑", "壬寅", "癸卯", "甲辰", "乙巳", "丙午", "丁未", "戊申", "乙酉", "庚戌", "辛亥", "壬子", "癸丑", "甲寅", "乙卯", "丙辰", "丁巳", "戊午", "己未", "庚申", "辛酉", "壬戌", "癸亥" }; public int yearZi=0; private void btnOk_Click(object sender, EventArgs e) { DateTime dt=Day.Value; int year=dt.Year; int moon = dt.Month; int date = dt.DayOfYear; MessageBox.Show("Test:"+(year%60-3)+":"+moon+":"+date); //调用获得年生辰的方法 String yearZi = yearZ(year); string moonZi = moonZ(moon,year); string dayZi = dayei(year, date); int hour = int.Parse(hourDate.Text); string hourZi= Hours(hour, date, year); txtBrithday.Text = yearZi+" "+moonZi+" "+dayZi+" "+hourZi; } private void Form1_Load(object sender, EventArgs e) { } //获得年生辰的方法 public string yearZ(int y) { int yearZie = yearNum(y); return date[yearZie-1]; } public string moonZ(int m,int year) { int yearZie = yearNum(year); if (yearZie >= 12) { if (yearZie % 10 == 6 || yearZie % 10 == 1) { return date[2+m-1]; } else if (yearZie % 10 == 2 || yearZie % 10 == 7) { return date[14 + m - 1]; } else if (yearZie % 10 == 3 || yearZie % 10 == 8) { return date[26 + m - 1]; } else if (yearZi % 10 == 4 || yearZi % 10 == 9) { return date[38 + m - 1]; } else if (yearZie % 10 == 5 || yearZie % 10 == 0) { return date[50 + m - 1 > 60 ? (m - 11) : 49 + m]; } } else { if (yearZie == 6 || yearZie == 1) { return date[2 + m - 1]; } else if (yearZie == 2 || yearZie == 7) { return date[14 + m - 1]; } else if (yearZie == 3 || yearZie == 8) { return date[26 + m - 1]; } else if (yearZi == 4 || yearZi == 9) { return date[38 + m - 1]; } else if (yearZie== 5 || yearZie == 10) { return date[50 + m - 1>60?(m-11):49+m]; } } return date[1]; } public string dayei(int year,int day) { int yearZie = yearNum(year); return date[(yearZie + day)%60-1]; } public string Hours(int hour,int day,int year) { int yearZie=yearNum(year); string strH = ""; int datey=(yearZie+day)%60-1; int dateZi=datey%10; if (dateZi == 1 || dateZi == 5) { strH += "甲"; } else if (dateZi == 2 || dateZi == 6) { strH += "丙"; } else if (dateZi == 3 || dateZi == 7) { strH += "戊"; } else if (dateZi == 4 || dateZi == 8) { strH += "庚"; } else if (dateZi == 5 || dateZi == 0) { strH += "壬"; } if (hour > 0 && hour <= 1) { strH+="子"; } else if (hour > 1 && hour <= 3) { strH += "丑"; } else if (hour > 3 && hour <= 5) { strH += "寅"; } else if (hour > 5 && hour <= 7) { strH += "卯"; } else if (hour > 7 && hour <= 9) { strH += "辰"; } else if (hour > 9 && hour <= 11) { strH += "巳"; } else if (hour > 11 && hour <= 13) { strH += "午"; } else if (hour > 13 && hour <= 15) { strH += "未"; } else if (hour > 15 && hour <= 17) { strH += "申"; } else if (hour > 17 && hour <= 19) { strH += "子"; } else if (hour > 19 && hour <= 21) { strH += "酉"; } else if (hour > 21 && hour <= 23) { strH += "戊"; } else if (hour > 0 && hour <= 1) { strH += "亥"; } return strH; } public int yearNum(int year) { int yearZie = year % 60 - 3; if (yearZie <= 0) { yearZie += 60; } return yearZie; } }}

追问

能不能提供完整的项目文件?VS的最好

已赞过

已踩过<

你对这个回答的评价是?

评论

收起

java 八字_计算生辰八字的C#或者java的Demo相关推荐

  1. java程序如何获取北京时间_计算当前的北京时间java(currentTimeMillis)

    计算当前的北京时间java(currentTimeMillis) 计算当前的北京时间java(currentTimeMillis) 当前北京时间 编写一个显示当前GMT时间的程序,该时间的格式为小时: ...

  2. 第三方工具监控java进程_前9个免费的Java进程监视工具以及如何选择一种

    第三方工具监控java进程 这样就可以运行Java代码了. 也许它甚至可以在生产服务器上运行. 当您做好工作后,我们得到了好消息和令人讨厌的消息. 令人讨厌的消息是,现在开始调试. 就是进行调试和应用 ...

  3. acm java题_【转】ACM中java的使用

    ACM中java的使用 这里指的java速成,只限于java语法,包括输入输出,运算处理,字符串和高精度的处理,进制之间的转换等,能解决OJ上的一些高精度题目. 1. 输入: 格式为:Scanner ...

  4. java 报表_市占率第一的Java报表工具 - FineReport报表工具

    作为国产Java报表工具的优秀代表,FineReport报表工具不仅仅在报表设计的简单易用上表现出极大的优势,更在数据分析等复杂报表处理能力和报表管理等报表综合应用上凸显出其报表技术的成熟和领先. 一 ...

  5. 华南农业大学java实验_华南农业大学2016年农科Java上机实验.doc

    HYPERLINK "javascript:%20tree.o(1);" 实验1 创建.编译和运行Java程序 17268?计算两个整数的和 从键盘输入两个整数,计算并输出两个整数 ...

  6. 微信公众号开发java流程_微信公众号开发教程java 编程语言的特点及选择

    微信公众号开发教程java 编程语言的特点及选择 微信公众号为用户提供了相关的工具,来对微信公众号进行一个简单的开发.但是如果想实现一些复杂的功能,其实还是要借助于一些编程语言的使用.所以要了解,在微 ...

  7. 基础贴吧java代码_原来你是这样的JAVA[01]-基础一瞥

    1.Java是什么呢? Java不仅是一门语言,而且是一个完整的平台,有一个庞大的库,其中包含了很多可重用的代码和一个提供安全性.跨操作系统的可移植性以及自动垃圾收集等服务的执行环境. 2.JDK 和 ...

  8. 小白学习python好还是java好_小白应该学Python还是Java?

    Java和Python两门语言都是目前非常热门的语言,可谓北乔峰南慕容,二者不分上下,棋逢对手.但是对于初学者来说,非常困惑,因为时间和精力有限,上手必须要先学一门,到底选那个好呢,今天3分钟带你透彻 ...

  9. cmd编译java命令_使用CMD命令编译执行java命令

    写程序时,有时候需要动态编译执行,经过各种百度及实战,总结一些使用经验. .java文件分为有包名,无包名,又分为有jar包,无jar包,是否指定jre等等. 接下来总结如下: cmd 编译执行jav ...

最新文章

  1. 数据库分享一: MySQL的Innodb缓存相关优化
  2. Delphi之对象库(Object Repository)
  3. 【AGC014E】Blue and Red Tree
  4. python爬虫中的ip代理设置
  5. CecOS v1.4 中文企业云操作系统 管理员及用户指南发布
  6. centos 下编译 gcc
  7. 1.今日标签:视频价值一千字
  8. 【C语言】str类与men库函数的实现(如:strcpy,strcmp,strstr,strcat,memmove,memcpy)
  9. 级差公排php如何_什么是专业级差?专业级差怎么安排专业?
  10. python考试搜题-大学mooc用Python玩转数据章节考试答案
  11. android webapi 返回html 代码,ANDROID调用VS2013 ASP.NET WEBAPI 返回DATATABLE 注意
  12. django-新的django项目
  13. 软件架构设计——软件架构风格
  14. C#、TypeScript之父Anders Hejlsberg:“会用Excel就是程序员 ”
  15. python怎么放音乐_python怎么添加背景音乐
  16. 啦啦外卖41.4全开源版 修复版(小程序+后台)
  17. 20210928 | Python案例:构建税费计算函数
  18. 222Beta多样性限制性排序CPCoA/CCA/RDA/LDA
  19. python局域网通信_python局域网获取数据 [python局域网传输文件]
  20. 2022年羊城杯wp

热门文章

  1. html5圆圈动画效果,CSS3实现光感圆圈动画效果
  2. 增强计算机的安全性能,使用ZA 和PC-Cillin增强安全性能
  3. 趋势科技PC-cillin2015,你来公測我发奖!
  4. zabbix前端无法访问,报502 BAD GATEWAY错误
  5. Transparent native-to-ascii conversion properties配置乱码
  6. SQL Server 数据查询 ①
  7. PhotoShop选区
  8. 如何给li前的圆点添加背景颜色
  9. pycharm运行弹出对话框
  10. 解决360安全浏览器cpu占用率一直高的问题