The first day of the quarter, and then you can convert the string to a date. There are many methods, including aliases (synonyms) for the same function. such as Curdate (), Current_date (), current_date, now, etc. can return to the same day
MySQL Tutorials > select Curdate (), ELT (Quarter (Curdate ()),
-> year (Curdate ()) *1000+0101,
-> year (Curdate ()) *1000+0401,
-> year (Curdate ()) *1000+0701,
-> year (Curdate ()) *1000+1001) as FIRSTDAYOFQ;
+------------+-------------+
| Curdate () | FIRSTDAYOFQ |
+------------+-------------+
| 2009-05-19 | 2009401 |
+------------+-------------+
1 row in Set (0.00 sec)
Mysql>
Get the first day of the quarter with the MySQL statement
On the first day of the month,
Date
Concat (Curdate (), '-', Month (Curdate ()), '-', ' 1 ')
The first day of the week
Curdate ()-
Weekday (Curdate ())
Get the first day of the quarter with the MySQL statement
Date
Concat (Curdate ()), '-',
if (Quarter (Curdate ()) =1,1,if (Quarter (Curdate ()) =2,4,if (Quarter (Curdate ()) =3,7,10))
Get the first day of the quarter with the MySQL statement:
Optimization:
Date
Concat (Year (Curdate ()), '-', ELT (quarter (Curdate ()), 1,4,7,10), '-', 1)
The first day of the week
Date_add (' 2009-5-29 '), Interval-weekday (' 2009-5-29 ') day)
MySQL Gets the same day publish file content SQL statement
SELECT * from ' p8_memberdata ' where RegDate BETWEEN (Unix_timestamp (Today ()) -86440) and now ()
SELECT * from ' p8_memberdata ' WHERE date_format (From_unixtime (regdate), '%y-%m-%d ') = Date_format (now (), '%y-%m-%d ') ORDER BY uid DESC