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里就可以了

 

搜网页制作素材 日历

小白云 (80元/月),四川德阳 4核2G,山东枣庄 4核2G,美国VPS20元/月起三网CN2

小白云是一家国人自营的企业IDC,主营国内外VPS,致力于让每一个用户都能轻松、快速、经济地享受高端的服务,成立于2019年,拥有国内大带宽高防御的特点,专注于DDoS/CC等攻击的防护;海外线路精选纯CN2线路,以确保用户体验的首选线路,商家线上多名客服一对一解决处理用户的问题,提供7*24无人全自动化服务。商家承诺绝不超开,以用户体验为中心为用提供服务,一直坚持主打以产品质量用户体验性以及高效...

LOCVPS:VPS主机全场8折,德国/荷兰/美国KVM终身7折

LOCVPS发来了针对元旦新年的促销活动,除了全场VPS主机8折优惠外,针对德国/荷兰KVM #1/美国KVM#2 VPS提供终身7折优惠码(限量50名,先到先得)。LOCVPS是一家成立于2012年的国人VPS服务商,提供中国香港、韩国、美国、日本、新加坡、德国、荷兰、俄罗斯等地区VPS服务器,基于KVM或XEN架构(推荐优先选择KVM),均选择直连或者优化线路,国内延迟低,适合建站或远程办公使...

BuyVM迈阿密KVM上线,AMD Ryzen 3900X+NVMe硬盘$2/月起

BuyVM在昨天宣布上线了第四个数据中心产品:迈阿密,基于KVM架构的VPS主机,采用AMD Ryzen 3900X CPU,DDR4内存,NVMe硬盘,1Gbps带宽,不限制流量方式,最低$2/月起,支持Linux或者Windows操作系统。这是一家成立于2010年的国外主机商,提供基于KVM架构的VPS产品,数据中心除了新上的迈阿密外还包括美国拉斯维加斯、新泽西和卢森堡等,主机均为1Gbps带...

calendar js为你推荐
ISDNISDN是什么?赶什么用的? 详细点谢谢!0x800700050x80070005是怎么回事?adversary英语match,是什么意思.?showwindowShowWindow和EnableWindow区别知识库管理系统如何加强知识库的管理最开放的浏览器目前最好的游览器?oracle索引如何在ORACLE数据库的字段上建立索引representspublic class是什么意思郭凡生慧聪的董事长是谁?跟马云比,怎么样?李昊天铠甲勇士2刑天的李昊天秘密是什么
厦门虚拟主机 精品网 免备案空间 空间打开慢 宕机监控 美国php主机 火车票抢票攻略 12u机柜尺寸 一元域名 html空间 网站cdn加速 老左来了 域名评估 双11秒杀 qq对话框 1美金 卡巴斯基破解版 微软服务器操作系统 备案空间 云服务器比较 更多