calendar js网页制作的日历`````````

calendar js  时间:2022-02-24  阅读:()

JAVA设计实现日历计算程序

展开全部 import java.text.*; import java.util.*; public class Test36 { public static void main(String[] args) { try { SimpleDateFormat farmatter = new SimpleDateFormat("yyyy-MM-dd"); Date d1, d2; int year, month; String temp; Scanner scan = new Scanner(System.in); System.out.print("请输入一个年月值 年份:"); year = scan.nextInt(); System.out.print("月份:"); month = scan.nextInt(); MyCalendar.listCalendar(year, month); System.out.print("请输入一个日期(yyyy-MM-dd):"); temp = scan.next(); d1 = farmatter.parse(temp); System.out.println(d1.toLocaleString() + " 是 " + MyCalendar.getDayOfWeek(d1)); System.out.print("请输入两个日期(yyyy-MM-dd) "); System.out.print("日期1 : "); temp = scan.next(); d1 = farmatter.parse(temp); System.out.print("日期2 : "); temp = scan.next(); d2 = farmatter.parse(temp); int diff = MyCalendar.dateDiff(d1, d2); System.out.printf("%s 和 %s 之间相隔 %d 天 ", d1.toLocaleString(), d2.toLocaleString(), diff); } catch (Exception e) { e.printStackTrace(); } } } class MyCalendar{ //1) 用户输入一个年份和月份,程序输出这个月的月历,每星期一行,星期天开始,星期六结束。 public static void listCalendar(int year, int month){ if(month<1 || month>12){ System.out.println(month + " 是非法的月份值,它的有效范围是 1~12"); return; } System.out.println(" " + year + " - " + month); System.out.println(" ---------------------------"); System.out.printf("%4s%4s%4s%4s%4s%4s%4s ", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"); try{ Calendar c = Calendar.getInstance(); c.set(year, month-1, 1); int num = getDays(year, month); //本月天数 int i; for(i=0; i System.out.print(" "); } for(i=0; i c.set(year, month-1, i+1); System.out.printf("%4s", i+1); if(c.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY){ System.out.println(); } } System.out.println(); } catch(Exception e){ e.printStackTrace(); } } //2) 用户输入一个日期,程序显示这个日期当天是星期几。 public static String getDayOfWeek(Date d){ String[] weeks = new String[]{"星期天","星期一","星期二","星期三","星期四","星期五","星期六"}; Calendar c = Calendar.getInstance(); c.setTime(d); return weeks[c.get(Calendar.DAY_OF_WEEK)-1]; } //3) 用户输入两个日期,程序计算这两个日期相差的天数。 public static int dateDiff(Date d1, Date d2) throws Exception { int i; int[] days = new int[]{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; Calendar c1, c2; int y1, y2; int diff0 = 0, diff1 = 0, diff2 = 0; c1 = Calendar.getInstance(); c1.setTime(d1); y1 = c1.get(Calendar.YEAR); c2 = Calendar.getInstance(); c2.setTime(d2); y2 = c2.get(Calendar.YEAR); //计算d1日期到d1所在年份第一天相隔的天数 days[1] = isLeapYear(y1) ? 29 : 28; for(i=1; i<=c1.get(Calendar.MONTH); i++){ diff1 += days[i-1]; } //计算d2日期到d2所在年份第一天相隔的天数 days[1] = isLeapYear(y2) ? 29 : 28; for(i=1; i<=c2.get(Calendar.MONTH); i++){ diff2 += days[i-1]; } //计算d1、d2两个日期的年份相隔的天数 if(y1 < y2){ for(i=y1; i diff0 += isLeapYear(i) ? 366 : 365; } } else if(y1 > y2){ for(i=y2; i diff0 += isLeapYear(i) ? 366 : 365; } diff0 *= -1; } return diff0 + diff2 - diff1 + c2.get(Calendar.DATE) - c1.get(Calendar.DATE); } //判断一个年份是否是闰年 public static boolean isLeapYear(int year){ return ((year%400==0) || (year%4==0 && year%100!=0)) ? true : false; } //返回某月的天数 public static int getDays(int year, int month){ if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12){ return 31; } else if(month == 4 || month == 6 || month == 9 || month == 11){ return 30; } else{ if(isLeapYear(year) == true){ return 29; } else{ return 28; } } } } 运行测试: 请输入一个年月值 年份:2011 月份:6 2011 - 6 --------------------------- Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 请输入一个日期(yyyy-MM-dd):2011-6-15 2011-6-15 0:00:00 是 星期三 请输入两个日期(yyyy-MM-dd) 日期1 : 2009-3-10 日期2 : 2011-6-15 2009-3-10 0:00:00 和 2011-6-15 0:00:00 之间相隔 827 天

网页制作的日历`````````

去下载个日历的FLV  各种风格的都有

百度一下 挑自己喜欢的 

然后镶嵌到HTML里就可以了

 

搜网页制作素材 日历

随风云25元/月 ,德阳高防云服务器 2核2G 10M 75元/月 内蒙古三线BGP服务器 2核2G 5M

公司介绍成都随风云科技有限公司成立于2021年,是国内领先的互联网业务平台服务提供商。公司专注为用户提供低价高性能云计算产品,致力于云计算应用的易用性开发,并引导云计算在国内普及。目前公司研发以及运营云服务基础设施服务平台(IaaS),面向全球客户提供基于云计算的IT解决方案与客户服务,拥有丰富的国内BGP、双线高防、香港等优质的IDC资源。公司一直秉承”以人为本、客户为尊、永续创新&...

RAKsmart 年中活动 独立服务器限时$30秒杀 VPS主机低至$1.99

RAKsmart 虽然是美国主机商,但是商家的主要客户群还是在我们国内,于是我们可以看到每次的国内节日促销活动期间商家也会发布促销。包括这次年中大促活动,RAKsmart商家也有发布为期两个月的年终活动,其中有商家擅长的独立服务器和便宜VPS主机。服务器包括站群服务器、特价服务器、高达10G带宽不限制流量的美国服务器。商家优惠活动,可以看到对应商品的优惠,同时也可以使用 优惠码 RAKBL9 同时...

酷锐云香港(19元/月) ,美国1核2G 19元/月,日本独立物理机,

酷锐云是一家2019年开业的国人主机商家,商家为企业运营,主要销售主VPS服务器,提供挂机宝和云服务器,机房有美国CERA、中国香港安畅和电信,CERA为CN2 GIA线路,提供单机10G+天机盾防御,提供美国原生IP,支持媒体流解锁,商家的套餐价格非常美丽,CERA机房月付20元起,香港安畅机房10M带宽月付25元,有需要的朋友可以入手试试。酷锐云自开业以来一直有着良好的产品稳定性及服务态度,支...

calendar js为你推荐
pexels手表上的17DEWELS什么意思jqlDX5JQL8WDPMW求大神帮查下是不是行货苹果spawningVC中Error spawning cl.exe错误的解决方法.图片存储怎么把存图片存储另一种方式?pci数据捕获和信号处理控制器大侠们,PCI数据捕获和信号处理控制器不能正常工作了要怎么解决啊,是不是要安装主板驱动啊?基础设施即服务基础设施、 产品服务、 财务和 () 这几个问题是商业模式设计需要去主要解决的。index是什么意思index.jsp是什么意思啊?index是什么意思?我没有英语词典网站免费收录免费个人网站能给百度收录吗网络管理员教程如何做好网管?工作日志系统工作日志怎么写?有哪几个步骤?
域名注册查询 域名停靠 老域名 上海域名注册 域名停靠一青草视频 中国域名交易中心 标准机柜尺寸 网通代理服务器 彩虹ip 500m空间 建立邮箱 免费测手机号 免费phpmysql空间 上海联通宽带测速 789电视剧 网站在线扫描 申请免费空间和域名 raid10 秒杀品 独立主机 更多