Get Current date
SELECT CURDATE();
Get Datetime now:
SET @dt = NOW();
SELECT @dt;
Få datetime bakåt i tiden:
now() - interval 1 month;
MySQL comes with the following data types for storing a date or a date/time value in the database:
DATETIME - format: YYYY-MM-DD HH:MI:SS TIMESTAMP - format: YYYY-MM-DD HH:MI:SS
SQL Server comes with the following data types for storing a date or a date/time value in the database:
DATETIME - format: YYYY-MM-DD HH:MI:SS SMALLDATETIME - format: YYYY-MM-DD HH:MI:SS TIMESTAMP - format: a unique number
Note: The date types are chosen for a column when you create a new table in your database!
Träna och laborera: