Calculate the day of the week for any day from 2000 to 2099 SDCC source code

Publisher:春水碧于天Latest update time:2015-07-16 Source: 51heiKeywords:SDCC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
// Calculate the day of the week for any day between 2000 and 2099
// year : 00-99
// month: 01-12
// day : 01-31
unsigned char GetWeekFromDay(unsigned char year,unsigned char month,unsigned char day)
{
    if( month == 1 || month == 2 )   
    {
        month += 12;
        if( year> 0 )
            year--;
        else
            year = 4;
    }

    // Returns the day of the week (Monday is 1 and Sunday is 7)
    return 1+(( day + 2*month + 3*(month+1)/5 + year + year/4 ) %7);
}  
Keywords:SDCC Reference address:Calculate the day of the week for any day from 2000 to 2099 SDCC source code

Previous article:ASCII 8×8 dot matrix font generator
Next article:Use STC12C5A60S2 to directly drive a 16*16 LED dot matrix display

Recommended ReadingLatest update time:2024-11-16 14:55

Also available on iOS! Google opens source code for Android 12 dynamic themes
In Android 12, Google added the Material You dynamic theme, which can color the theme based on the color of the user's wallpaper. Recently, Google announced that it will open source the Material Color Utilities code library at the core of this feature , thereby bringing this feature to more platforms including iOS .
[Mobile phone portable]
Also available on iOS! Google opens source code for Android 12 dynamic themes
Overview of information and source code for using microcontroller to design and implement a keyboard
1. Experimental tasks As shown in Figure 4.14.2, use the parallel port P1 of AT89S51 to connect to a 4×4 matrix keyboard, use P1.0-P1.3 as the input line, and use P1.4-P1.7 as the output line; it is displayed on the digital tube The "0-F" serial number of each button. The sequence number arrangement of the correspo
[Microcontroller]
Overview of information and source code for using microcontroller to design and implement a keyboard
STM8 MCU + RC522 circuit schematic + card reader source code
Do not write data in the third area of ​​the ds1302 module based on stm8, otherwise the card will be locked. It can only be written in the second area. The circuit schematic is as follows:       stm8 microcontroller source code: /* Includes ------------------------------------------------------------------*/ /
[Microcontroller]
STM8 MCU + RC522 circuit schematic + card reader source code
Digital voltmeter made by single chip microcomputer and source code
A digital voltmeter is designed using the microcontroller AT89S51 and ADC0809. It can measure DC voltage values ​​between 0 and 5V and has a four-digit display, but uses the least number of components. #include unsigned char code dispbitcode ={0xfe,0xfd,0xfb,0xf7, 0xef,0xdf,0xbf,0x7f}; unsigne
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号