当前位置:首页 > 代码 > 正文

日历源代码(日历源代码 安卓)

admin 发布:2022-12-19 03:08 90


本篇文章给大家谈谈日历源代码,以及日历源代码 安卓对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

ASP+JS日历源代码

直接保存成 asp文件 运行就可以

html

head

meta http-equiv="Content-Type" content="text/html; charset=gb2312" /

link href="" rel="schema.DC" /

title日历/title

/head

body bgcolor="#FFFFFF"

%

' 要调用的函数声明

'根据年份及月份得到每月的总天数

Function GetDaysInMonth(iMonth, iYear)

Select Case iMonth

Case 1, 3, 5, 7, 8, 10, 12

GetDaysInMonth = 31

Case 4, 6, 9, 11

GetDaysInMonth = 30

Case 2

If IsDate("February 29, " iYear) Then

GetDaysInMonth = 29

Else

GetDaysInMonth = 28

End If

End Select

End Function

'得到一个月开始的日期.

Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)

Dim dTemp

dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)

GetWeekdayMonthStartsOn = WeekDay(dTemp)

End Function

'得到当前一个月的上一个月.

Function SubtractOneMonth(dDate)

SubtractOneMonth = DateAdd("m", -1, dDate)

End Function

'得到当前一个月的下一个月.

Function AddOneMonth(dDate)

AddOneMonth = DateAdd("m", 1, dDate)

End Function

' 函数声明结束

Dim dDate ' 日历显示的日期

Dim iDOW ' 每一月开始的日期

Dim iCurrent ' 当前日期

Dim iPosition ' 表格中的当前位置

' 得到选择的日期并检查日期的合法性

If IsDate(Request.QueryString("date")) Then

dDate = CDate(Request.QueryString("date"))

Else

If IsDate(Request.QueryString("month") "-" Request.QueryString("day") "-" Request.QueryString("year")) Then

dDate = CDate(Request.QueryString("month") "-" Request.QueryString("day") "-" Request.QueryString("year"))

Else

dDate = Date()

If Len(Request.QueryString("month")) 0 Or Len(Request.QueryString("day")) 0 Or Len(Request.QueryString("year")) 0 Or Len(Request.QueryString("date")) 0 Then

Response.Write "您所选择的日期格式不正确,系统会使用当前日期.BRBR"

End If

End If

End If

'得到日期后我们先得到这个月的天数及这个月的起始日期.

iDIM = GetDaysInMonth(Month(dDate), Year(dDate))

iDOW = GetWeekdayMonthStartsOn(dDate)

%

table width="180" height="100%" border="0" cellpadding="0" cellspacing="0"

tr

tdtable width="150" border="0" align="center" cellpadding="0" cellspacing="0"

tr

td height="5" /td

/tr

/table

table width="180" border="0" align="center" cellpadding="0" cellspacing="0"

tr

td align="center" colspan="7"table border="0" cellpadding="0" cellspacing="0"width="100%"

tr

td height="22" align="right"a href="rl.asp?date=%= SubtractOneMonth(dDate) %"img src="../images/dot_left.gif" width="15" height="14" border="0" //a/td

td align="center"font color="999999"b%= MonthName(Month(dDate)) " " Year(dDate) %/b/font/td

tda href="rl.asp?date=%= AddOneMonth(dDate) %"img src="../images/dot_right.gif" width="15" height="14" border="0" //a/td

/tr

/table/td

/tr

tr

td width="25" height="22" align="center"font

color="d08c00"b日/b/font /td

td width="25" align="center"bfont color="999999"一/font/b /td

td width="25" align="center"bfont color="999999"二/font/b /td

td width="25" align="center"bfont color="999999"三/font/b /td

td width="25" align="center"bfont color="999999"四/font/b /td

td width="25" align="center"bfont color="999999"五/font/b /td

td width="25" align="center"bfont color="d08c00"六/font/b /td

/tr

%

' 如果这个月的起始日期不是周日的话就加空的单元.

If iDOW 1 Then

Response.Write vbTab "TR" vbCrLf

iPosition = 1

Do While iPosition iDOW

Response.Write vbTab vbTab "TD /TD" vbCrLf

iPosition = iPosition + 1

Loop

End If

' 绘制这个月的日历

iCurrent = 1

iPosition = iDOW

Do While iCurrent = iDIM

' 如果是一行的开头就使用 TR 标记

If iPosition = 1 Then

Response.Write vbTab "TR" vbCrLf

End If

' 如果这一天是我们选择的日期就高亮度显示该日期.

If iCurrent = Day(dDate) Then

Response.Write vbTab vbTab "TD BGCOLOR=#eeeeee height=18 align=centerB" iCurrent "/B/TD" vbCrLf

Else

Response.Write vbTab vbTab "TD height=18 align=centerA HREF=""./rl.asp?date=" Month(dDate) "-" iCurrent "-" Year(dDate) """" iCurrent "/A/TD" vbCrLf

End If

' 如果满一周的话表格就另起一行

If iPosition = 7 Then

Response.Write vbTab "/TR" vbCrLf

iPosition = 0

End If

iCurrent = iCurrent + 1

iPosition = iPosition + 1

Loop

' 如果一个月不是以周六结束则加上相应的空单元.

If iPosition 1 Then

Do While iPosition = 7

Response.Write vbTab vbTab "TD /TD" vbCrLf

iPosition = iPosition + 1

Loop

Response.Write vbTab "/TR" vbCrLf

End If

%

/table

table width="150" border="0" align="center" cellpadding="0" cellspacing="0"

tr

td height="5" /td

/tr

/table/td

/tr

/table

求日历的HTML代码...

网页台历代码如下:html

head

title网页上的日期台历/title

STYLE

A.menuitem {

COLOR: menutext; TEXT-DECORATION: none

}

A.menuitem:hover {

COLOR: highlighttext; BACKGROUND-COLOR: highlight

}

DIV.contextmenu {

BORDER-RIGHT: 2px outset; BORDER-TOP: 2px outset; Z-INDEX: 999; VISIBILITY: hidden; BORDER-LEFT: 2px outset; BORDER-BOTTOM: 2px outset; POSITION: absolute; BACKGROUND-COLOR: buttonface

}

/STYLE

/head

body

SCRIPT language=JavaScript

function Year_Month(){

var now = new Date();

var yy = now.getYear();

var mm = now.getMonth()+1;

var cl = 'font color="#0000df"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + yy + '年' + mm + '月/font'); }

function Date_of_Today(){

var now = new Date();

var cl = 'font color="#ff0000"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + now.getDate() + '/font'); }

function Day_of_Today(){

var day = new Array();

day[0] = "星期日";

day[1] = "星期一";

day[2] = "星期二";

day[3] = "星期三";

day[4] = "星期四";

day[5] = "星期五";

day[6] = "星期六";

var now = new Date();

///

var cl = 'font color="#0000df"';

if (now.getDay() == 0) cl = 'font color="#c00000"';

if (now.getDay() == 6) cl = 'font color="#00c000"';

return(cl + day[now.getDay()] + '/font'); }

function CurentTime(){

var now = new Date();

var hh = now.getHours();

var mm = now.getMinutes();

var ss = now.getTime() % 60000;

ss = (ss - (ss % 1000)) / 1000;

var clock = hh+':';

if (mm 10) clock += '0';

clock += mm+':';

if (ss 10) clock += '0';

clock += ss;

return(clock); }

function refreshCalendarClock(){

document.all.calendarClock1.innerHTML = Year_Month();

document.all.calendarClock2.innerHTML = Date_of_Today();

document.all.calendarClock3.innerHTML = Day_of_Today();

document.all.calendarClock4.innerHTML = CurentTime(); }

var webUrl = webUrl;

document.write('table border="0" cellpadding="0" cellspacing="0"trtd');

document.write('table id="CalendarClockFreeCode" border="0" cellpadding="0" cellspacing="0" width="60" height="70" ');

document.write('style="position:absolute;visibility:hidden" bgcolor="#eeeeee"');

document.write('trtd align="center"font ');

document.write('style="cursor:hand;color:#ff0000;font-size:14pt;line-height:120%" ');

if (webUrl != 'netflower'){

document.write('/td/trtrtd align="center"font ');

document.write('style="cursor:hand;color:#2000ff;font-size:9pt;line-height:110%" ');

}

document.write('/td/tr/table');

document.write('table border="0" cellpadding="0" cellspacing="0" width="61" bgcolor="#C0C0C0" height="70"');

document.write('trtd valign="top" width="100%" height="100%"');

document.write('table border="1" cellpadding="0" cellspacing="0" width="58" bgcolor="#FEFEEF" height="67"');

document.write('trtd align="center" width="100%" height="100%" ');

document.write('font id="calendarClock1" style="font-size:7pt;line-height:120%"/fontbr');

document.write('font id="calendarClock2" style="color:#ff0000;font-family:Arial;font-size:14pt;line-height:120%"/fontbr');

document.write('font id="calendarClock3" style="font-size:9pt;line-height:120%"/fontbr');

document.write('font id="calendarClock4" style="color:#100080;font-size:8pt;line-height:120%"b/b/font');

document.write('/td/tr/table');

document.write('/td/tr/table');

document.write('/td/tr/table');

setInterval('refreshCalendarClock()',1000);

/SCRIPT

/body

/html

日历代码

万年历代码:

iframe

src=""

width="509"

height=433

marginwidth="0"

marginheight="0"

hspace="0"

vspace="0"

frameborder="0"

scrolling="no"/iframe

老黄历的源代码:

IFRAME

style="BORDER-RIGHT:

#000000

1px

dotted;

BORDER-TOP:

#000000

1px

dotted;

BORDER-LEFT:

#000000

1px

dotted;

BORDER-BOTTOM:

#000000

1px

dotted"

border=0

name=nongli

marginHeight=0

src=""

frameBorder=no

width=149

scrolling=no

height=140/IFRAME

最新日历代码(包括日历、星期、现在时间)

IFRAME

border=0

name=www1.xise.cn

align=center

marginWidth=0

marginHeight=0

src=""

frameBorder=0

width=146

scrolling=no

height=183/IFRAME

代码一:IFRAME

style="BORDER-RIGHT:

#000000

1px

dotted;

BORDER-TOP:

#000000

1px

dotted;

BORDER-LEFT:

#000000

1px

dotted;

BORDER-BOTTOM:

#000000

1px

dotted"

border=0

name=nongli

marginHeight=0

src=""

frameBorder=no

width=149

scrolling=no

height=140/IFRAME

代码二:iframe

name="jiro23"

src=""

width="500"

height="500"/iframe

代码三:iframe

scrolling=no

height=170

width=165

frameborder=0

marginHeight=0

marginWidth=0

src=;/iframe

具体步骤是:复制代码---管理博客-----新增空白面板-----钩选显示源代码(出现钩号,同时文档里出现DIV的字样)----粘贴代码----钩选显示源代码(钩号消失)-----保存新增面板----定制个人首页----选取新增个人面板----保存设置

求C语言编日历源代码的详细说明

/*

稍微改了下对齐格式,加了注释

*/

/*

1、闰年的算法:

如果某年能被4整除但不能被100整除,

或者能被400整除,

则该年是闰年.

用表达式表示就是

(year

%4

==

year%100

!=

0)

||

(year%400

==

0)

2、计算某一天是星期几:

已知1900年的1月1号为星期一,

然后就可以用某一天和1900年的1月1号相差的天数对7取余来求星期,

本题是用的公元1年的1月1号作为基准

*/

#include

stdio.h

#includeconio.h

#includestdlib.h

int

IsLeapYear(int);

//函数定义

void

main()

{

int

i;

int

day;

int

year;

int

temp;

int

temp_i;

long

int

Year_days

=

0;

int

Year_Start

=

1;

int

Per_Year_Days;

int

month_day[]={31,28,31,30,31,30,31,31,30,31,30,31,29};

printf("Please

enter

the

year:

");

scanf("%d",year);

//输入年份

while(Year_Start

year)

//从公元1年开始执行while循环,

该年的一月一号为星期一

{

if(

IsLeapYear(

Year_Start

)

)

Per_Year_Days

=

366;

//如果是闰年,

则一年有366天

else

Per_Year_Days

=

365;

//如果不是闰年,

则一年有365天

Year_days

=

Year_days

+

Per_Year_Days;

//Year_days为从公元1年到输入年份的前一年的天数的总和

Year_Start++;

}

for(

temp

=

1;

temp

=12;

temp++

)

//temp从1到12,

对应一年内12个月

{

switch(

temp

)

//用switch语句将temp和12个月对应起来

{

case

1:

printf("

January(%d)\n",year);

//一月

break;

case

2:

printf("

February(%d)\n",year);

//二月

break;

case

3:

printf("

March(%d)\n",year);

//三月

break;

case

4:

printf("

April(%d)\n",year);

//四月

break;

case

5:

printf("

May(%d)\n",year);

//五月

break;

case

6:

printf("

June(%d)\n",year);

//六月

break;

case

7:

printf("

July(%d)\n",year);

//七月

break;

case

8:

printf("

August(%d)\n",year);

//八月

break;

case

9:

printf("

September(%d)\n",year);

//九月

break;

case

10:

printf("

October(%d)\n",year);

//十月

break;

case

11:

printf("

November(%d)\n",year);

//十一月

break;

case

12:

printf("

December(%d)\n",year);

//十二月

break;

}

i

=

Year_days

%

7;

//每个星期有7天,

故用每年的天数对7取余

printf("Mon\tTue\tWed\tThu\tFri\tSat\tSun\n");

if(

i

!=

)

//如果余数不为零

for(

temp_i

=

0;

temp_i

i;

temp_i++)

printf("\t");

//则打印空格(这里用\t代替空格,

更加美观),

空格数为i

day

=

1;

//初始化day为1,

为下面的while循环做准备

if(

IsLeapYear(year)

temp

==

2)

//如果输入的年份是闰年,

并且月份为2

while(

day

=

month_day[12]

)

//day为一循环变量,

取值为1-365(闰年的话为1-366)

{

if(

day

1

)

//如果天数大于一

if(

Year_days

%

7

==

)

//如果是星期日,

则换行

printf("\n");

if(

day

=

10

)

printf("%d\t",day);

//打印天数+空格

else

printf("%d\t",day);

Year_days++;

day++;

}

else

//如果不满足"输入的年份是闰年,

并且月份为2"

while

(day

=

month_day[temp-1])

{

if(

day

1

)

if(

Year_days

%

7

==

)

printf("\n");

if(

day

=10

)

printf("%d\t",day);

else

printf("%d\t",day);

Year_days++;

day++;

}

printf("\n");

if(

getch()

==

'q'

)

//如果输入为q,

则退出程序

exit(0);

}

getch();

//每按一次键,

打印一个月份

}

int

IsLeapYear(

int

year

)

{

//判断是否是闰年,

是则返回1,

否则返回0

if

((year

%4

==

0)

(year

%

100

!=

0)

||

(year

%

400

==

0)

)

return

1;

else

return

0;

}

C语言的简单日历代码,求大神帮忙!!

#includestdio.h

#include string.h

#include time.h

#include math.h

#include windows.h

int year , month , day ;

int day_of_month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};

//char wek[7]={'周日','周一','周二','周三','周四','周五','周六'};

int current_year,current_month,current_day;

/************************************通用关键函数**************************************************/

void cls_screen()

{

printf("请按任意键返回!\n");

getchar();

getchar();

system("cls");

}

void get_current_time() //获取当前时间

{

time_t timep;

struct tm *p;

time(timep);

p = gmtime(timep);

current_year=1900+p-tm_year;

current_month=1+p-tm_mon;

current_day=p-tm_mday;

}

int judgement (int y)

{

if (y % 400 == 0 || (y % 100 !=0 y %4 ==0))

return 1 ;

else return 0 ;

}

int show_week (int year , int month , int day)

{

/*

公式:w=(y+[y/4]+[c/4]-2c+[26(m+1)/10]+d-1)%7

*/

int w ,k; //记录周几

int year_last=year %100,c=year/100 , m = month;

if (month==1 )

{

year_last-=1 ;

m=13 ;

}

else if (month==2)

{

year_last-=1;

m=14;

}

w = (year_last + year_last/4 + c/4 - 2*c +26*(m+1)/10+day-1); // abs 绝对值

if (w0)

{

k=(w%7+7)%7;

}

else k=w%7;

return k ;

}

/************************************第一部分**************************************************/

void print_year (int year)

{

int i , k ,x ,first_week;

printf ("请输入想要查询的年月(格式如2012):");

scanf ("%d",year);

printf("=======================%d年===========================\n",year);

printf("\n");

if (judgement(year))

{

day_of_month[1]=29;

}

else day_of_month[1]=28;

for (i=1 ; i 13 ; i++)

{

first_week = show_week(year,i,1);

printf("=====================%d月日历如下========================\n",i);

printf ("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n");

for (x=1;x=first_week;x++)

{

printf("\t");

if (x%7==0) printf ("\n");

}

for (k=1;k=day_of_month[i-1];k++)

{

printf("%d\t",k);

if (x%7==0) printf ("\n");

x++;

}

printf("\n");

printf("\n");

printf("\n");

}

}

/************************************第二部分**************************************************/

void print_year_month ()

{

int k ,x ,first_week;

printf ("请输入想要查询的年月(格式如2012 12):");

do

{

scanf ("%d %d",year,month);

if (month1||month12)

{

printf("您输入的月份有误哦~请输入正确的月份\n");

printf ("请输入想要查询的年月(格式如2012 12):");

}

}while(1month||month12);

printf("=====================%d年%d月======================\n",year,month);

if (judgement(year))

{

day_of_month[1]=29;

}

else day_of_month[1]=28;

first_week = show_week(year,month,1);

printf ("Sun\tMon\tTue\tWed\tThu\tFri\tSat\n");

for (x=1;x=first_week;x++)

{

printf("\t");

if (x%7==0) printf ("\n");

}

for (k=1;k=day_of_month[month-1];k++)

{

printf("%d\t",k);

if (x%7==0) printf ("\n");

x++;

}

printf("\n");

}

/************************************第三部分**************************************************/

int year_before_sumdays (int year,int month, int day)

{

int days=0 ,i,judgement1;

int temp_day=0 ,sum_days; //

//printf ("%d,%d\n",current_year,current_month);

judgement1=judgement(year);

/*===================比当前少=====================*/

if (year current_year )

{

for (i = year+1;i current_year ;i++)

{

if (judgement(i))

{

days=days+356;

}

else days+=355;

}

for (i = month+1;i=12;i++)

{

days=days+day_of_month[i-1];

}

days = days + day_of_month[month-1]-day; //指定日子距离当年结束还有多少天

//printf("去年还有%d\n",days);

for (i = 0;i current_month-1;i++ )

{

if (judgement1)

{

day_of_month[1]=29;

}

temp_day = temp_day + day_of_month[i];

}

//当前日子是这一年的多少天

temp_day = temp_day + current_day;

//printf("今天是第%d天\n",temp_day);

sum_days=temp_day + days ;

}

/*===================比当前多=====================*/

if (year current_year )

{

for (i =current_year+1;i current_year ;i++)

{

if (judgement(i))

{

days=days+356;

}

else days+=355;

}

for (i = current_month+1;i=12;i++)

{

days=days+day_of_month[i-1];

}

days = days + day_of_month[month-1]-current_day; //指定日子距离当年结束还有多少天

//printf("去年还有%d\n",days);

for (i = 0;i month-1;i++ )

{

if (judgement1)

{

day_of_month[1]=29;

}

temp_day = temp_day + day_of_month[i];

}

//当前日子是这一年的多少天

temp_day = temp_day + day;

//printf("今天是第%d天\n",temp_day);

sum_days=temp_day + days ;

}

/*===================比当前一样=====================*/

if (year == current_year )

{

if(month current_month)

{

for (i=month+1;icurrent_month;i++)

{

if (judgement1)

{

day_of_month[1]=29;

}

days = days + day_of_month[i];

}

sum_days = days + current_day + day_of_month[month-1] - day ;

}

if (monthcurrent_month)

{

for (i=current_month+1;imonth;i++)

{

if (judgement1)

{

day_of_month[1]=29;

}

days = days + day_of_month[i];

}

sum_days = days + day + day_of_month[month-1] - current_day ;

printf("%d\n",days);

}

if (month==current_month)

{

sum_days= abs(day-current_day);

}

}

return sum_days ;

}

void print(int year,int month,int day)

{

int week;

printf ("请输入想要查询的年月(格式如2012 12 12 ):");

do

{

scanf ("%d %d %d",year,month,day);

if (judgement(year))

{

day_of_month[1]=29;

}

printf("\n");

if (day=0 || day day_of_month[month-1])

printf ("%d月没有%d,请重新输入(格式如2012 12 12 ):",month,day);

}while(day=0 || day day_of_month[month-1]);

week=show_week (year,month ,day);

printf("\n");

switch(month)//判断查找天是否阳历节日先由月份判断是否有节日的月份再由日判断是否为节日

{

case 1:switch(day)

{

case 1:printf("元旦") ;break;

default:printf("不是阳历节日");

}break;

case 2:switch(day)

{

case 14:printf("情人节(Valentines Day)");break;

default:printf("不是阳历节日");

}break;

case 3:switch(day)

{

case 8:printf("妇女节¨(Women's Day)");break;

case 12:printf("植树节(Arbor Day)");break;

default:printf("不是阳历节日");

}break;

case 4:switch(day)

{

case 1:printf("愚人节(April Fools Day)");break;

case 5:printf("清明节(Tomb-sweeping Day)");break;

default:printf("不是阳历节日");

}break;

case 5:switch(day)

{

case 1:printf("劳动节(Labor Day)");break;

case 4:printf("中国青年节(Chinese Youth Day)");

default:printf("不是阳历节日");

}break;

case 6:switch(day)

{

case 1:printf("儿童节(Children's Day)");break;

default:printf("不是阳历节日");

}break;

case 8:switch(day)

{

case 1:printf("建军节(the Army's Day)");break;

default:printf("不是阳历节日");

}break;

case 9:switch(day)

{

case 10:printf("教师节(Teacher's Day)");break;

default:printf("不是阳历节日");

}break;

case 10:switch(day)

{

case 1:printf("国庆节(National Day)");break;

case 31:printf("万圣节(Helloween Day)");break;

default:printf("不是阳历节日");

}break;

case 12:switch(day)

{

case 25 :printf("圣诞节(Christmas Day)");break;

default:printf("不是阳历节日");

}break;

}

printf("\n");

printf("%d年%d月%d号是:",year,month,day);

switch(week)//判断所查找天是星期几

{

case 0:printf("Sunday");break;

case 1:printf("Monday");break;

case 2:printf("Tuesday");break;

case 3:printf("Wednesday");;break;

case 4:printf("Thursday");break;

case 5:printf("Friday");break;

case 6:printf("Saturday");break;

}

printf("\n");

printf("距离今天有%d天\n",year_before_sumdays ( year, month, day));

printf("\n");

}

/********************************************************************************************/

void main ()

{

int choice,year,month,day,flag=1;

char c , k;

for(;1;)//显示程序菜单,为永真,每次查找完回到程序菜单ì

{

printf("===================================菜单选项===================================\n");

printf("请选择:\n");

printf("* * * * * * * * 1.查找某一年的年历 * * * * * * * *\n");

printf("* * * * * * * * 2.查找某一月的月历 * * * * * * * *\n");

printf("* * * * * * * * 3.查找某一天 * * * * * * * *\n");

printf("* * * * * * * * 0.退出 * * * * * * * *\n");

printf("=========================================================

用JAVA做日历,要求源代码

import java.util.Scanner; public class Wan{ public static void main(String[] args){ Scanner name = new Scanner(System.in); System.out.print("请输入要查询的年份:"); int year = name.nextInt(); System.out.print("请输入该年的月份"); int month = name.nextInt(); } //累加 该年至输入的月份 天数 //比如 输入2009年的 3月分 // 那就累加 2009年的1月至 3月1号的总天数 public void sumDay(int year,int month){ int day = 0; int sumDay = 0; for(int i = 1;i=month;i++){ switch(i){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: day = 31; break; case 2: if(year % 4 == 0 || year % 400 == 0 year %100!=0){ day = 29; }else{ day = 28; } break; default: day = 30; } //最后一个月份不要累加 因为我们只是要算到该月的一号就可以了 if(i month){ sumDay += day; } } //累加 2000年到该年的一月一号天数 for(int i = 2000;iyear;i++){ if( i % 4 == 0 || i %400== 0 i % 100 != 0){ sumDay += 366; }else{ sumDay += 365; } } //求该月一号为星期几 int week = sumDay % 7 +1; if(week == 7){ week = 0; } } public void fomatDate(int week,int day){ int g = 0; for(int i = 0;iweek;i++){ System.out.print("\t"); } for(int i = 1;i=day;i++){ System.out.print(i+"\t"); g = week + i; if(g % 7 == 0){ System.out.println(); } } } } 给点分哈 写得好累

日历源代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于日历源代码 安卓、日历源代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/1441.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载