栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

显示2021年日历

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

显示2021年日历

如何显示一个日历/Java 二、具体代码 1.确定每个月的月历显示

代码如下:

public static int calendar(int first,int month,int year) {
		int day = 0;
		System.out.print("			"+month);
		System.out.println("                           2021");
		System.out.printf("     ---------------------------------------------------n");
		System.out.printf("%8s%8s%8s%8s%8s%8s%8sn","Sun","Mon","Tue","Wed","Thu","Fri","Sat");
		if(month ==1||month == 3||month == 5||month==7||month ==8||month == 10||month == 12)
		{
			day = 31;
		}
		if(month ==4||month==6||month ==9||month==11)
		{
			day = 30;
		}
		if(month ==2)
		{
			if(year%4==0&&year%100!=0||year%400==0)
			{
				day = 29;
				
				}
			else {

				day = 28;
			}
		}
		for(int j = 0;j 
2.确定该月处到1月1日的时间距离 

代码如下:

public static int Numberofmonth(int year,int month)
	{
		if(month ==1||month == 3||month == 5||month==7||month ==8||month == 10||month == 12)
		{
			return 31;
		}
		if(month ==4||month==6||month ==9||month==11)
		{
			return 30;
		}
		if(month ==2)
		{
			if(year%4==0&&year%100!=0||year%400==0)
			{
				return  29;
				
				}
			else {

				return 28;
			}
		}
		return 0;
		
	}
3.全部代码

代码如下:

import java.time.DayOfWeek;

import javax.*;

public class elapsed_time 
{
	public static void main(String[] args) {
		//2021年9月1日到1月1日的距离
		//1月1日是星期五
		int t = 5;
		int year =2021;
		int month = 9;
		int day = 0;
		int d = 0;//月初是星期几
		
		for(int i = 1;i 
 

运行结果

这是我的一个博客,希望以后继续坚持。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/304044.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号