JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Handbok Databaskommunikation
Huvudmoment
Databas
Google Cloud
Big Query
API
Protokoll
Säkerhet
MySQL Workbench
More
Share
Explore
SQL
Dates
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:
DATE
- format YYYY-MM-DD
DATETIME
- format: YYYY-MM-DD HH:MI:SS
TIMESTAMP
- format: YYYY-MM-DD HH:MI:SS
YEAR
- format YYYY or YY
SQL Server
comes with the following data types for storing a date or a date/time value in the database:
DATE
- format YYYY-MM-DD
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:
https://www.w3schools.com/sql/sql_dates.asp
https://www.c-sharpcorner.com/UploadFile/65fc13/work-with-date-and-time-in-mysql/
https://www.mysqltutorial.org/mysql-datetime/
https://www.digitalocean.com/community/tutorials/how-to-work-with-dates-and-times-in-sql
Loading…
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.