We help IT Professionals succeed at work.

Default Date Value

lulu50
lulu50 asked
on
327 Views
Last Modified: 2012-05-11
Hi,

In MySQL I want to set the date default value to today's date.
I tried getdate(), date() nothing works
Comment
Watch Question

you can use CURDATE() in mySQL

or if your using coldfusion
you can use
<cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" value="#Now()#">
SharathData Engineer
CERTIFIED EXPERT

Commented:
CURDATE(), CURRENT_DATE() give you the current date.
CURTIME(), CURRENT_TIME() give you the current time.
NOW(), CURRENT_TIMESTAMP() give you the current date with time.
lulu50Web application

Author

Commented:
Sharath_123:

I want to set up my date in MySQL control panel. I tried all but nothing is working
Field Type Length/Values1 Collation Attributes Null Default2 Extra Comments
Field:
SiteVisitDate
Type:
Date
Default:
????
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
Our posts crossed ...

Well like I said above, the MySQL manual says that's not supported for Date columns.  Only TimeStamp columns.
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
lulu50Web application

Author

Commented:
yes, I agree with agx_:
I am only can do this TIMESTAMP  
ok, now I know that it does not support it.
Thank you .
lulu50Web application

Author

Commented:
Thank you
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.