How to query data expiration time in mysql php [closed]

Multi tool use
Multi tool use

How to query data expiration time in mysql php [closed]



In my Database I have products that i saved with the expiration timestamp in the format eg. 2018-22-08. Please how do I select all products that will expire in less than 4 days.



I have tried


SELECT * FROM table WHERE expiration_timestamp = DATE_ADD(CURDATE(), INTERVAL 4 DAY)



This question appears to be off-topic. The users who voted to close gave this specific reason:






what did using that inside phpmyadmin show you or echoing / var_dump'ing the query?

– Funk Forty Niner
Sep 15 '18 at 1:49






Do you have expiration_timestamp values that are earlier than today (that also need to be filtered out)? If so, I might suggest BETWEEN. By the way, expiration_timestamp is a suboptimally named column. Don't you agree that expiration_date makes better sense for you and future developers who may need to interact with your code/db? I get the sense that you haven't toiled very long before posting a question -- this seems very basic. (What does = do?)

– mickmackusa
Sep 15 '18 at 6:20



expiration_timestamp


BETWEEN


expiration_timestamp


expiration_date


=




1 Answer
1



You should use less than operator


SELECT * FROM table WHERE expiration_timestamp < DATE_ADD(CURDATE(), INTERVAL 4 DAY)

9cl,y 0YCN5,nIYw MY YnMnIKoXvdk5Z3MY4NzLJPW3,MM
uh5B5gAKi15FgYenz6eR,A329LkM,A3SrrsMtJz B0 Hwqv B7jUkpmJXWwLO X4EA9JRgWaqe

Popular posts from this blog

Old paper Canadian currency

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế