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

 

搜网页制作素材 日历

牦牛云(3.5USD/月 )阿里云国际版云服务器 1核1G40G

收到好多消息,让我聊一下阿里云国际版本,作为一个阿里云死忠粉,之前用的服务器都是阿里云国内版的VPS主机,对于现在火热的阿里云国际版,这段时间了解了下,觉得还是有很多部分可以聊的,毕竟,实名制的服务器规则导致国际版无需实名这一特点被无限放大。以前也写过几篇综合性的阿里云国际版vps的分析,其中有一点得到很多人的认同,那句是阿里云不管国内版还是国际版的IO读写速度实在不敢恭维,相对意义上的,如果在这...

2021年国内/国外便宜VPS主机/云服务器商家推荐整理

2021年各大云服务商竞争尤为激烈,因为云服务商家的竞争我们可以选择更加便宜的VPS或云服务器,这样成本更低,选择空间更大。但是,如果我们是建站用途或者是稳定项目的,不要太过于追求便宜VPS或便宜云服务器,更需要追求稳定和服务。不同的商家有不同的特点,而且任何商家和线路不可能一直稳定,我们需要做的就是定期观察和数据定期备份。下面,请跟云服务器网(yuntue.com)小编来看一下2021年国内/国...

水墨云历史黑名单IDC,斟酌选购

水墨云怎么样?本站黑名单idc,有被删除账号风险,建议转出及数据备份!水墨云ink cloud Service是成立于2017年的商家,自2020起开始从事香港、日本、韩国、美国等地区CN2 GIA线路的虚拟服务器租赁,同时还有台湾、国内nat vps相关业务,也有iplc专线产品,相对来说主打的是大带宽服务器产品。注意:本站黑名单IDC,有被删除账号风险,请尽量避免,如果已经购买建议转出及数据备...

calendar js为你推荐
detected电脑打不开出来个invalid signature detected check securesoapui下载测试管理工具的soapUI开源测试工具策略组组策略完全使用方法查字网“很”去掉双人旁读什么?rdl电脑主机上的dvd+rdl是什么意思网页微信客户端什么叫微信网页版?和电脑版是一回事吗?spawning急救!编好C++程序后(确认无误),再编译时总出现error spawning 是什么意思?是不是系统出了问题radius认证PPPoE有认证的功能,RADIUS也有验证功能,两者有区别么??国际加速世界经济全球化加速发展的表现有哪些?在全球化趋势加强的过程中,人类共同面临的问题有哪些?新手怎么制作表格怎么样在电脑上制作表格初学者
互联网域名管理办法 新加坡服务器 国外服务器 轻量 英文站群 中国智能物流骨干网 php空间申请 个人域名 服务器托管什么意思 常州联通宽带 外贸空间 丽萨 云服务器比较 云服务是什么意思 七牛云存储 cdn服务 mteam 锐速 zcloud 傲盾代理 更多