Discover how to calculate day of week from date, include the articles, news, trends, analysis and practical advice about how to calculate day of week from date on alibabacloud.com
How to calculate the day of the week?Slowtiger published on 2009-11-19 08:42:00How to calculate the day of the week?--Caille (Zeller) formulaWhat is the day of the week in history? What day of the future is the week? With regard to this problem,
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");
/* (Start of program header annotation)* Copyright and version Declaration of the program* Copyright (c) 2011, a student from the computer College of Yantai University* All rights reserved.* File name: enter a date, which is the day of the year.*
1 ORACLE mid-week related knowledge description 1.1 Date formatting functions To_char (X [,FORMAT]) : Press X toFORMATThe format is converted into a string. X is a date,FORMATis a format string that specifies the format in which X is
--Caille (Zeller) formulaWhat is the day of the week in history? What day of the future is the week? With regard to this problem, there are many computational formulae (two general formulas and some piecewise formulas), the most notable of which is
Declare @ date & nbsp; datetimeset @ dategetdate (): Current date + Monday (2nd days per week) the number of days difference from the current date -- datepart (weekday, date) the returned value is related to @ datefirst setdatefirst7 -- or set it to
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
DECLARE @ DateDATETIMESET @ DateGETDATE () -- previous DAY, previous DAY of given Date SELECTDATEADD (DAY,-1, @ Date) AS previous DAY -- next DAY, next DAY of given Date SELECTDATEADD (DAY, 1, @ Date) AS the next day GO -- the beginning of the month,
Local Test Cases:
# there can be no spaces on either side of the equal sign, before the error has been out here
yesterday= ' date-d last-day +%y-%m-%d '
echo $yesterday
curday= ' Date +%y-%m-%d '
echo $curday
echo "Now time: ' Date ' +%y%m%d%T '"
No nonsense.CodeThe comment is very detailed. It is certainly okay to understand it!
Declare @ date datetimeSet @ date = getdate ()-The previous day, the previous day of the given dateSelect dateadd (day,-1, @ date) as 'previous Day'-The next day,
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.