Discover how to calculate any day of any year, include the articles, news, trends, analysis and practical advice about how to calculate any day of any year on alibabacloud.com
First, use your formula to compile a simple program:
Main ()
{Int year;/* year */
Intw;/* day of the week */
Scanf ("% d", & year );
W = (year-1) + (year-1)/4-(year-1)/100 + (year-1)/400 + 1) % 7;
Printf ("% d \ n", W );
Getch ();
}
Enter 1 during
How do I calculate the day of the week? --Caille (Zeller) formulaWhat is the day of the week in history? What day of the week is the future? There are a number of computational formulae (two general calculation formulae and some piecewise
Kimlarsson calculation formula determines the day
of the week by the date calculateweekday (int y, int m,int d) {
if (m==1| | m==2) m+=12,y--;
int iweek = (d+2*m+3* (m+1)/5+y+y/4-y/100+y/400)%7;
Switch (iweek) {case
0:printf ("Monday \ n");
Common parametersFormat: DateDisplays the current date time.Format: Date mmddhhmm # In short, it's the day of the month.Format: Date mmddhhmmyyyyFormat: Date MMDDHHMM.SSFormat: Date MMDDHHMMYYYY.SSSet the current date time, only the root user can
These two tips, do not write do not know, a write scare!
Are seemingly simple, actually do up on the Meng, have to think carefully, can write right!
All have the date operation of the program should be careful Oh!
Let's say the second one:
2.
Main ideas:
For any 2 dates, such as: Date_start=2006-10-1, date_end=2006-10-14, first calculate the interval between the dates (days), and then get their next Monday date for Date_start and Date_end respectively. So you can get a new full date
PS: After learning Regular Expressions for so long, I didn't make any decent patterns. I woke up early and came up with a whimsy, I made up my mind to prove that my regular expression is not white-so I chose the most common date match ......
/*note:your Choice is C IDE*/#include"stdio.h"voidMain () {intY,m,d;//year, month, day intcr,ds=0I//CR: The variable that determines whether it is a leap year, is 1, no 0;ds: The sum of the days; I is a loop variable Charrun[ A] = { to, in, to,
The performance of programmers , like a long history puzzle, has long plagued a large number of programmers and their leaders.KPI (key performance indicators KPIs) is an enterprise's favorite performance appraisal tool, but KPIs usually only have a
First, you need to understand an international standard: ISO8601, which is the International Organization for Standardization (ISO) notation for defining dates and times, which is the representation of data storage and interchange, information
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.