Current Date on record creation

I am having a hard time getting this simple task to work:

1. I have a field, created_date , Type: datetime

2. I want today's date inserted when a record is created.

I have tried NOW() , CURDATE, etc.

Nothing is working.

Any suggestions?

Who is Participating?
DcpKingConnect With a Mentor Commented:
Please post your insert statement: I would have expected it to be something like
insert into TableName
(field1, field2, created_date)
(val1, val2, curdate());

Open in new window

OTOH, try specifying CurDate() as the default value for the field. Then when you insert a new record, you can just omit the field entirely and the date will be inserted in automatically (same as above - just don't mention the last field in either the field list or the value list).


either one should work.  Can you post your insert statement?  Also post what happens after you run it, e.g. error message, actual resulting row that was inserted.
edvinsonAuthor Commented:
I am actually getting the error INSIDE of my Database Mgmt software, called Navicat.

I suppose I will use the CMD line to alter the table, and see if that works. Is that what you would suggest?
not knowing the actual statement and error message, I cannot suggest anything further.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.