2
I’m developing a system in PHP
where: I make available an entry contest page for the staff, but this page has an end time, example: The page will be available from today 08/05/18 :17:11 and will disappear on 09/05/18 23:59:00. I know I can capture the current date and time on mysql
using the following select: SELECT DATE_FORMAT(NOW(), '%d/%m/%Y %H:%i:%s');
. I need to somehow compare this date with the date specified at the end of the contest and when arriving at the given time, no longer display the same.
I did not post code because I really could not develop anything, I need a light on how to proceed. I am developing the system in PHP
pure, no framework. Can anyone help me?
Perfect, thank you!
– Jorge.M
Example of consultation:
SELECT * FROM nome_tabela WHERE data_final < DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s');
– Jorge.M
No need to format the date NOW() already returns the correct date =)
– arllondias
Yes, but I need the time too, now only returns the date and not time.
– Jorge.M
@Jorgematheus must have something wrong in his config
MySQL
then why theNOW()
must return date and time. 'The NOW() Function Returns the Current date and time. ' Ref: https://www.w3schools.com/sql/func_mysql_now.asp– arllondias
Really, there was. Thank you!
– Jorge.M