Problem : GETDATE and GETUTCDATE does not exist in MySQL

Problem : GETDATE and GETUTCDATE does not exist in MySQL

I’ve got a web application that works well with MS-SQL 2000 and MS-SQL 2005 databases. I’ve copied the database to My SQL 5.0 successfully.

However I’m getting errors on the GETUTCDATE() and GETDATE() functions.

SQL >  update WORKUSERS set LOGINCOUNT=(LOGINCOUNT+1),LOGINDATE=getutcdate() where USERID=’xxxx’;

[MySQL][ODBC 3.51 Driver][mysqld-5.0.67.d7-ourdelta-log]FUNCTION workdb01.getutcdate does not exist

so I thought perhaps there was something wrong with my SQL syntax…  so I tried with the brackets, withut brackets, uppercase, lowercase, etc:

getutcdate
getutcdate()
GETUTCDATE
GETUTCDATE()

getdate
getdate()
GETDATE
GETDATE()

and no matter what I try I get a MySQL error.

What am I doing wrong?

 

Solution : GETDATE and GETUTCDATE does not exist in MySQL

Here are the MySql functions that should solve your problem:

UTC_DATE()
UTC_TIME()
UTC_TIMESTAMP()

CURDATE()
NOW() [date/time]
TIMESTAMP()