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,
In MySQL database, you often encounter the content of the day of statistics.For example, in the user table, the Date field is: Log_timeStatistics DayThe SQL statement is:Select * from User where = curdate (); Curdate () indicates the date of the
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");
Like 20151225 in this format. What method to find out is the day of the week ... The new person asks for advice.
Reply to discussion (solution)
$time = time ();echo Date (' D ', $time); Day of the week, the text indicates that 3
SELECT * FROM table WHERE convert (Nvarchar, DateAndTime, 111) = CONVERT (Nvarchar, GETDATE (), 111) ORDER by DateAndTime DESCRecord of the Month
SELECT * FROM table WHERE DateDiff (Month,[dateadd],getdate ()) =0
Week
================================================The--WW algorithm starts every January 1 for the first week, date+6 the end of each week.-for example, 20050101 is the first day of the first week, and the last day of the first week is 20050101+6=20050
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
The first and last day of the week
Copy CodeThe code is as follows:
$date =new DateTime ();
$date->modify (' this week ');
$first _day_of_week= $date->format (' y-m-d ');
$date->modify (' This week +6 days ');
$end _day_of_week= $date->format ('
Echo ' The first day of the week (Sunday is the beginning of the week): '. Date (' y-m-d ', Time () -86400*date (' W ')). '';
Echo ' The first day of the week (Monday is the beginning of the week): '. Date (' y-m-d ', Time () -86400*date (' W
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.