Rank: Advanced Member Groups: Member
Joined: 6/9/2008 Posts: 203 Points: 621 Location: California, USA
|
how to get date in mysqlI am developing an application in which i wanted to insert date into mysql table field, I know that there is some command in MS SQL that may used as the default value for the fields (DateTime datatype) will generate date & time value when a new row is inserted. I wanted to apply this in my application but have no idea how to implement that if someone aware of this please let me know.
|
Rank: Advanced Member Groups: Member
Joined: 3/31/2008 Posts: 113 Points: 339 Location: London
|
how to get date in mysqlFrom the following link you could use any method like
SEC_TO_TIME(),STR_TO_DATE(),CURRENT_TIMESTAMP(), CURRENT_TIMESTAMP
The Functions that expect date values usually accept datetime values and ignore the time part. Functions that expect time values usually accept datetime values and ignore the date part.
mysql> SELECT something FROM tbl_name -> WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;
Or you may use the above Functions that return the current date or time each are evaluated only once per query at the start of query execution. This means that multiple references to a function such as NOW() within a single query always produce the same result.
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2008 Posts: 226 Points: 484 Location: US
|
how to get date in mysqlI hope this tutorial information will help you http://www.tizag.com/mysqlTutorial/mysql-date.php Test Management
|