php - Query problem of today's birthday in solar calendar and lunar calendar result set.
ringa_lee
ringa_lee 2017-05-16 13:16:34
0
1
517

Database Design

is_lunar Whether the lunar calendar (0=solar calendar, 1=lunar calendar)
birthday birthday (date type directly saves the birthday format 1985-07-19)

question

How to query the record set of today’s birthday?

ps: Mysql’s date function knowledge is almost zero. I don’t know how to write it. I hope you guys can give me some advice. I’m very grateful.

First supplement

This is how I write it now, it should be no problem.

$solar = 当前阳历月份和日(04-11)
$lunar = 当前农历月份和日(03-15)
select * from table where ( is_lunar = 0 and date_format(birthday, '%m-%d') = {$solar} ) or ( is_lunar = 1 and DATE_FORMAT(birthday,'%m-%d') = {$lunar}) 
ringa_lee
ringa_lee

ringa_lee

reply all(1)
我想大声告诉你

I know a PHP class for converting lunar calendar and solar calendar. It is recommended to use PHP to convert it, and then query it after confirming a date.
SQL can probably be like this, select * from users where (is_lunar = 1 and birthday = 2017-03-15) or (is_lunar = 0 and birthday = 2017-04-11)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template