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

 

搜网页制作素材 日历

特网云(1050元),IP数5 个可用 IP (/29) ,美国高防御服务器 无视攻击

特网云特网云为您提供高速、稳定、安全、弹性的云计算服务计算、存储、监控、安全,完善的云产品满足您的一切所需,深耕云计算领域10余年;我们拥有前沿的核心技术,始终致力于为政府机构、企业组织和个人开发者提供稳定、安全、可靠、高性价比的云计算产品与服务。官方网站:https://www.56dr.com/ 10年老品牌 值得信赖 有需要的请联系======================特网云美国高防御...

腾讯云爆款秒杀:1C2G5M服务器38元/年,CDN流量包6元起

农历春节将至,腾讯云开启了热门爆款云产品首单特惠秒杀活动,上海/北京/广州1核2G云服务器首年仅38元起,上架了新的首单优惠活动,每天三场秒杀,长期有效,其中轻量应用服务器2G内存5M带宽仅需年费38元起,其他产品比如CDN流量包、短信包、MySQL、直播流量包、标准存储等等产品也参与活动,腾讯云官网已注册且完成实名认证的国内站用户均可参与。活动页面:https://cloud.tencent.c...

提速啦(24元/月)河南BGP云服务器活动 买一年送一年4核 4G 5M

提速啦的来历提速啦是 网站 本着“良心 便宜 稳定”的初衷 为小白用户避免被坑 由赣州王成璟网络科技有限公司旗下赣州提速啦网络科技有限公司运营 投资1000万人民币 在美国Cera 香港CTG 香港Cera 国内 杭州 宿迁 浙江 赣州 南昌 大连 辽宁 扬州 等地区建立数据中心 正规持有IDC ISP CDN 云牌照 公司。公司购买产品支持3天内退款 超过3天步退款政策。提速啦的市场定位提速啦主...

calendar js为你推荐
食品商务网食品方面的网站那个最好!拓扑关系拓扑关系在GIS中的作用jqlDX5JQL8WDPMW求大神帮查下是不是行货苹果spawningvc出现error spawning c1.exe怎么解决?ruby语言ruby什么意思?什么含义?暴力破解密码用什么方法才能破解别人密码什么是SOA什么是cookies 有什么作用文件系统类型常见的文件类型有哪几种?screencapture求一款这样的截图软件toolstrip工具栏ToolStrip中图标的大小怎么改变
vps是什么意思 淘宝二级域名 泛域名绑定 256m内存 好看的桌面背景图 国外免费空间 云鼎网络 京东商城双十一活动 php空间申请 七夕促销 美国在线代理服务器 便宜空间 cxz wordpress中文主题 购买空间 网站加速 深圳主机托管 accountsuspended ipower gotoassist 更多