Search code examples
mysqlsqljspdatesqlyog

SQL current system date


I have a query to store current system date by calling the sysdate date-time function. But it is giving me error that your sql syntax is not correct. Here is the query

insert into mtc (entryDate) values TO_DATE(sysdate,'fmyyyy-mm-dd');

I have tried this below query it worked properly but in DB it stores 0000-00-00 insert into mtc (entryDate) values ('sysdate');

As i am using SQLyog, its date format is yyyy-mm-dd. Further, i have to use this query in my jsp code. What will be its syntax in jsp ?

Kind regards.


Solution

  • You're missing parentheses from SYSDATE(), and SYSDATE default format is yyyy-mm-dd so that part probably isn't needed.