🧚 Listen! Beekeeper Studio is a fast, modern, and open source database GUI Download
July 2, 2025 By Matthew Rathbone

To insert a date in SQL, write it in your INSERT statement as a 'YYYY-MM-DD' string, or use a function such as CURRENT_DATE for today’s date. The examples work in PostgreSQL, MySQL, SQLite and SQL Server.

How to insert a date in SQL

Write the date as a string in 'YYYY-MM-DD' format. When the column is a date type, the database turns the string into a date:

INSERT INTO table_name (date_column) VALUES ('YYYY-MM-DD');
INSERT INTO orders (order_id, customer, order_date)
VALUES (2, 'Tom', '2021-06-15');

For a TIMESTAMP or DATETIME column, add the time after a space, using a 24-hour clock:

INSERT INTO flights (flight_no, departs_at)
VALUES ('UA 940', '2026-11-02 17:45:00');
-- In SQL Server, make departs_at a DATETIME2: its TIMESTAMP type isn't a date

For today’s date, put CURRENT_DATE where the string would go, without quotes. CURRENT_TIMESTAMP gives the date and time:

INSERT INTO orders (order_id, customer, order_date)
VALUES (3, 'Priya', CURRENT_DATE);
-- In SQL Server, use CAST(GETDATE() AS DATE): it has no CURRENT_DATE

-- Output (the new row, run on 2026-10-13):
-- order_id | customer | order_date
-- ---------+----------+-----------
-- 3        | Priya    | 2026-10-13

Rules to know

  • Stick to 'YYYY-MM-DD'. Other formats depend on the database’s settings. PostgreSQL and SQL Server read '06/15/2021' as month/day/year, and MySQL rejects it:
INSERT INTO orders (order_id, customer, order_date) VALUES (4, 'Ana', '06/15/2021');
-- MySQL: ERROR 1292 (22007): Incorrect date value: '06/15/2021' for column 'order_date' at row 1
  • SQLite doesn’t check dates. It has no date type and stores whatever text you give it. Its date functions can’t read '06/15/2021', and they roll '2021-02-30' over to 2021-03-02.
  • MySQL’s TIMESTAMP only covers 1970 to 2038. Use DATETIME for birthdays, historical dates and anything far in the future:
-- MySQL
CREATE TABLE people (name VARCHAR(50), born_at TIMESTAMP);
INSERT INTO people (name, born_at) VALUES ('Ada Lovelace', '1815-12-10 00:00:00');
-- ERROR 1292 (22007): Incorrect datetime value: '1815-12-10 00:00:00' for column 'born_at' at row 1
  • “Now” is in the database’s time zone (always UTC in SQLite). If your users are in more than one time zone, store UTC.

Alternative syntax

You’ll also meet each database’s own names for today and now:

  • MySQL: CURDATE() and NOW(). PostgreSQL has NOW() too.
  • SQLite: date('now') and datetime('now').
  • SQL Server: CAST(GETDATE() AS DATE) and GETDATE(). It has no CURRENT_DATE, so today’s date needs the cast.

When do you need to insert a date?

Most date inserts are one of these five jobs, and each has its own tool.

Record a date you already know

Birthdays, due dates and appointments come from a person or a form. Type them as 'YYYY-MM-DD' strings.

Stamp today’s date or the current time

Order dates, sign-up dates and audit logs should come from the database’s clock, not from a value someone typed. Use CURRENT_DATE or CURRENT_TIMESTAMP (GETDATE() in SQL Server), or make one the column’s default.

Store a time as well as a date

Meetings, flights and log entries need the time too. Use a DATETIME or TIMESTAMP column and write 'YYYY-MM-DD HH:MM:SS'.

Calculate a date from another one

Due dates, renewals and reminders fall a set time after another date. Let the database do the arithmetic: + INTERVAL in PostgreSQL and MySQL, DATEADD() in SQL Server and date() with a modifier in SQLite.

Load dates written in another format

Spreadsheets and CSV exports often hold dates like 06/15/2021. Convert them as you insert: STR_TO_DATE() in MySQL, TO_DATE() in PostgreSQL and CONVERT() with a style number in SQL Server. SQLite can’t parse other formats, so rearrange the text with substr().

Real examples of inserting dates

Add several dates in one statement

A list of public holidays goes in with one INSERT and a row of values per date:

INSERT INTO holidays (holiday_name, holiday_date)
VALUES
  ('Independence Day', '2026-07-04'),
  ('Thanksgiving', '2026-11-26'),
  ('Christmas Day', '2026-12-25');

Fill in today’s date with a default

Give the column a default and every INSERT that leaves it out gets today’s date. MySQL needs the parentheses around CURRENT_DATE:

CREATE TABLE orders (
  order_id INT,
  customer_id INT,
  order_date DATE DEFAULT (CURRENT_DATE)  -- SQL Server: DEFAULT CAST(GETDATE() AS DATE)
);

INSERT INTO orders (order_id, customer_id) VALUES (1, 42);

-- Output (the new row, run on 2026-10-13):
-- order_id | customer_id | order_date
-- ---------+-------------+-----------
-- 1        | 42          | 2026-10-13

Save a local meeting time as UTC

Someone in New York books a meeting for 9:30 AM their time. Convert it to UTC as you insert, so everyone’s times line up:

INSERT INTO meetings (title, starts_at_utc)
VALUES ('Design review', TIMESTAMP '2026-10-20 09:30:00' AT TIME ZONE 'America/New_York' AT TIME ZONE 'UTC');
-- MySQL (once its time zone tables are loaded):
--   CONVERT_TZ('2026-10-20 09:30:00', 'America/New_York', 'UTC')
-- SQL Server:
--   CAST('2026-10-20 09:30:00' AS DATETIME2) AT TIME ZONE 'Eastern Standard Time' AT TIME ZONE 'UTC'

-- Output (the new row):
-- title         | starts_at_utc
-- --------------+--------------------
-- Design review | 2026-10-20 13:30:00

SQLite has no named time zones, so convert in your application before inserting.

Set a renewal date a month ahead

A subscription renews one month after it starts. Work out the renewal date in the INSERT:

INSERT INTO subscriptions (customer, started_on, renews_on)
VALUES ('Tom', '2026-10-13', DATE '2026-10-13' + INTERVAL '1' MONTH);
-- SQL Server: DATEADD(month, 1, '2026-10-13')
-- SQLite:     date('2026-10-13', '+1 month')

-- Output (the new row):
-- customer | started_on | renews_on
-- ---------+------------+-----------
-- Tom      | 2026-10-13 | 2026-11-13

Watch the end of the month in SQLite. From January 31 it overflows into March, where the other databases stop at February 28:

SELECT date('2026-01-31', '+1 month');
-- Output: 2026-03-03

Import day/month/year dates

A supplier sends invoices dated the UK way, 15/06/2021. Tell the database the layout as you insert:

INSERT INTO invoices (invoice_no, issued_on)
VALUES ('INV-1002', TO_DATE('15/06/2021', 'DD/MM/YYYY'));
-- MySQL:      STR_TO_DATE('15/06/2021', '%d/%m/%Y')
-- SQL Server: CONVERT(date, '15/06/2021', 103), where style 103 is dd/mm/yyyy
-- SQLite can't parse dates: rearrange the text with substr()

-- Output (the new row):
-- invoice_no | issued_on
-- -----------+-----------
-- INV-1002   | 2021-06-15

Further reading about inserting dates

On this blog:

Official documentation:

Beekeeper Studio Is A Free & Open Source Database GUI

Best SQL query & editor tool I have ever used. It provides everything I need to manage my database. - ⭐⭐⭐⭐⭐ Mit

Beekeeper Studio is fast, intuitive, and easy to use. Beekeeper supports loads of databases, and works great on Windows, Mac and Linux.

Beekeeper's Linux version is 100% full-featured, no cut corners, no feature compromises.

What Users Say About Beekeeper Studio

★★★★★
"Beekeeper Studio completely replaced my old SQL workflow. It's fast, intuitive, and makes database work enjoyable again."
— Alex K., Database Developer
★★★★★
"I've tried many database GUIs, but Beekeeper strikes the perfect balance between features and simplicity. It just works."
— Sarah M., Full Stack Engineer

Ready to Improve Your SQL Workflow?

download Download Free