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

 

搜网页制作素材 日历

Virmach款低价VPS可选可以选择多个机房,新增多款低价便宜VPS主机7.2美元起

Virmach商家我们是不是比较熟悉?速度一般,但是人家价格低,而且机房是比较多的。早年的时候有帮助一个有做外贸也许需要多个机房且便宜服务商的时候接触到这个商家,有曾经帮助够买过上百台这样的低价机器。这里需要提醒的,便宜但是速度一般,尤其是中文业务速度确实不快,如果是外贸业务,那肯定是没有问题。这几天,我们有看到Virmach推出了夏季优惠促销,VPS首年8折,最低年付仅7.2美元,多机房可选,如...

MineServer:香港CMI/洛杉矶GIA VPS,2核/2GB内存/20GB NVME/3.5TB流量/200Mbps/KVM,288元/年

mineserver怎么样?mineserver是一家国人商家,主要提供香港CN2 KVM VPS、香港CMI KVM VPS、日本CN2 KVM VPS、洛杉矶cn2 gia端口转发等服务,云服务器网(yuntue.com)介绍过几次,最近比较活跃。现在新推出了3款特价KVM VPS,性价比高,香港CMI/洛杉矶GIA VPS,2核/2GB内存/20GB NVME/3.5TB流量/200Mbps...

ftlcloud(超云)9元/月,1G内存/1核/20g硬盘/10M带宽不限/10G防御,美国云服务器

ftlcloud怎么样?ftlcloud(超云)目前正在搞暑假促销,美国圣何塞数据中心的云服务器低至9元/月,系统盘与数据盘分离,支持Windows和Linux,免费防御CC攻击,自带10Gbps的DDoS防御。FTL-超云服务器的主要特色:稳定、安全、弹性、高性能的云端计算服务,快速部署,并且可根据业务需要扩展计算能力,按需付费,节约成本,提高资源的有效利用率。点击进入:ftlcloud官方网站...

calendar js为你推荐
fclose为什么fclose之后remove还是不成功foxmail邮箱注册FOXMAIL邮箱在哪里可以注册?电子日历我想做个项目 如何在电子日历中进行时间的选择deviceidAndroid里DeviceId和AndroidId都是什么意思?tvosairpods什么意思 airpods连接方式是怎样的备忘录模式手机如何设置备忘录提醒调度系统配送调度系统是干嘛的?是手机还是电脑的系统?editplus破解版DBTools Manager Professional 破解版在哪里可以下载?索引超出了数组界限求助大神什么叫索引超出了数组界限索引超出了数组界限索引超出了数组界限是怎么回事啊?
大庆服务器租用 域名备案收费吗 谷歌域名邮箱 香港主机 bash漏洞 directadmin 贵州电信宽带测速 windows2003iso 网站实时监控 警告本网站 嘟牛 免费网站申请 七夕快乐英文 佛山高防服务器 php空间购买 免费dns解析 腾讯总部在哪 免费外链相册 谷歌台湾 主机返佣 更多