用户登陆 用户注册
您的位置:首页> 电脑专栏>内容正文
计算星期几的C代码
[正文]:计算星期几的c代码static uchar   clkday;               /* counters for local date                                      */static uchar   clkdow;               /* day of week (0 is sunday)                                    */static uchar   clkmonth;static uint    clkyear;typedef struct clk_month 123;             uchar  monthdays;                /* number of days in each month                                 */    char  *monthname;                /* name of the month                                            */    uchar  monthval;                 /* value used to compute day of the week                        */125; clk_month;static clk_month code clkmonthtbl[] = 123;    /* months table                                                 */    123;0,  "",           0125;,             /* invalid month                                                */    123;31, "january ",   6125;,             /* january                                                      */    123;28, "february ",  2125;,             /* february (note leap years are handled by code)               */    123;31, "march ",     2125;,             /* march                                                        */    123;30, "april ",     5125;,             /* april                                                        */    123;31, "may ",       0125;,             /* may                                                          */    123;30, "june ",      3125;,             /* june                                                         */    123;31, "july ",      5125;,             /* july                                                         */    123;31, "august ",    1125;,             /* august                                                       */    123;30, "september ", 4125;,             /* september                                                    */    123;31, "october ",   6125;,             /* october                                                      */    123;30, "november ",  2125;,             /* november                                                     */    123;31, "december ",  4125;              /* december                                                     */125;;/***********************************************************************************************************                                         compute day-of-week** description : this function computes the day of the week (0 == sunday) based on the current month,*               day and year.* arguments   : none.* returns     : none.* notes       : - this function updates clkdow.*               - this function is called by clkupdatedate().**********************************************************************************************************/#if clk_date_enstatic  void  clkupdatedow (void)123;    uint dow;        dow = clkday + clkmonthtbl[clkmonth].monthval;    if (clkmonth < 3)    123;        if (clkisleapyear(clkyear))         123;            dow--;        125;    125;    dow    += clkyear + (clkyear / 4);    dow    += (clkyear / 400) - (clkyear / 100);    dow    %= 7;    clkdow  = dow;125;


网站首页 培训课程 维修指南
技术文章 家电专栏 供应信息
求购信息 培训资讯 展会信息
电脑专栏 教程下载 资料下载
常用软件 PLC教程 PLC资料
变频伺服 低压电器 维修资料
人机界面 自控仪表 工控机类
文章标题: 搜文章
中国工控资源网手机版 2012
电话:010-67577139 13811659603
培训咨询QQ:657167934 471895637 销售咨询QQ:623769457
联系邮箱:zggkzyw@163.com
 京ICP备11002135号
报时(2026-04-05 00:20:46) 流量统计