I want to Check if the Timestamp of now is greater than my Expired Timestamp:
id | created_timestamp | expired_timestamp
1 | 1542570971 | 1542743771
I have tried:
SELECT * FROM premium WHERE expired_timestamp >= now();
Nothing works :/
You simply need to use UNIX_TIMESTAMP() function:
SELECT * FROM premium
WHERE expired_timestamp >= UNIX_TIMESTAMP();
NOW() function returns current datetime in YYYY-MM-DD HH:MM:SS format. While Unix_Timestamp() function will return the current datetime's unix timestamp value (unsigned integer). You need to use the latter in your case.
I think you want UNIX_TIMESTAMP():
SELECT *
FROM premium
WHERE expired_timestamp >= UNIX_TIMETAMP();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With