GetDate() Equivalent for MySQL DB

Hello,

in MS SQL there is a command that I can issue where when used as the default value for
the fields (DateTime datatype) will generate date & time value when a new row is inserted.

CREATE TABLE [TBL_TABLE](
 [fldDATE] [datetime] NULL DEFAULT (GetDate())
 )
GO

What would be the equivalent of GetDate() for MySQL ? How can I set a field in a table to generate
the current date when a new row is inserted ? Thanks !

vpekulasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

todd_farmerCommented:
To define a default value for a date/time related column, you need to use TIMESTAMP:

http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html
todd_farmerCommented:
Here's a relevent example from the above link:

CREATE TABLE t (ts TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
                             DEFAULT CURRENT_TIMESTAMP);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BogoJokerCommented:
Hi vpekulas,

NOW(), CURRENT_TIMESTAMP(), CURRENT_TIME(), CURRENT_DATE(), CURTIME()
'' <-- Will automatically do NOW() in a DATE field

Here are all of them, you should definantly read over this page, its got it all!:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

Joe P
BogoJokerCommented:
Whoop, you snuck in there todd =)
Use todd's example its perfect for you.
Make sure you checkout the mysql docs we both posted.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.