Resolved: curdate() instead of sysdate()
Is there a difference between using curdate() and sysdate()?
CREATE TRIGGER hire_date_check
BEFORE INSERT ON employees
FOR EACH ROW
IF NEW.hire_date > curdate() THEN
SET NEW.hire_date = curdate();
Sys date refers to the current date on the SERVERwhere the database is located but curdate() refers to the current date on your ownCLIENT. In this context there is no difference to which one you use.
Hope this helps!
Hi Vladimir and Mohaned!
Thanks for reaching out.
Thanks for sharing this piece of information with the Community!
CURDATE() function returns the time stamp of the client while the
SYSDATE() function returns the time stamp of the server. If both server and the client are on the same machine, then, the result of both commands are the same. But in case that your sever is for example in USA and your clients are in China, then, these two functions return completely different results.
Hope this helps.