- 1). Log into your MySQL database. Access the query tool.
- 2). Type the following query to enter the current date into a table and then execute the query:
INSERT INTO table_name VALUES ( CURDATE( ) );
This query assumes the table you provide with "table_name" only has one field that accepts dates as the field type. The "CURDATE" function returns the current date and time, but because the field only holds "date" and not "datetime" types, the time portion returned from CURDATE gets omitted. - 3). Type the following query to enter a specific date into a table and then execute the query:
INSERT INTO table_name VALUES ( '2011-01-01' );
This query inserts this specific date into the table. You may use other punctuation characters to delimit the dates, such as a period or a slash.
SHARE