SQL Keywords

SQL UTC_DATE

What is the UTC_DATE function in SQL?

Returns the current date in Coordinated Universal Time (UTC) as a 'YYYY-MM-DD' value.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL UTC_DATE:

SQL UTC_DATE Full Explanation

UTC_DATE is a MySQL and MariaDB built-in date function that outputs the current calendar date based on Coordinated Universal Time, ignoring the session or server time zone. The function is deterministic within a single statement and non-deterministic across statements because the value changes as days roll over at 00:00:00 UTC. UTC_DATE returns a value of type DATE (not DATETIME), so no time component is included. Parentheses are optional, but using them is recommended for clarity. When used in numeric context, the result is returned as an integer in the form YYYYMMDD. If the server or connection time zone differs from UTC, UTC_DATE still returns the UTC value, making it useful for time-zone-agnostic logging, replication, and auditing.

SQL UTC_DATE Syntax

UTC_DATE();
-- or
UTC_DATE

SQL UTC_DATE Parameters

Example Queries Using SQL UTC_DATE

-- Get the current UTC date
SELECT UTC_DATE();

-- Alias the result for clearer output
SELECT UTC_DATE() AS today_utc;

-- Compare local date to UTC date
SELECT CURDATE()   AS local_date,
       UTC_DATE()  AS utc_date;

-- Insert a creation date in UTC into a table
INSERT INTO events (name, created_on)
VALUES ('signup', UTC_DATE());

Expected Output Using SQL UTC_DATE

  • Each query returns a single DATE value like '2024-05-18'
  • In numeric context it would appear as 20240518
  • INSERT statements store that value in DATE columns

Use Cases with SQL UTC_DATE

  • Store dates in a neutral time zone for globally distributed applications
  • Compare local server date with UTC to detect clock drift
  • Generate reports that must align on one calendar regardless of regional settings
  • Populate audit tables where UTC is a compliance requirement

Common Mistakes with SQL UTC_DATE

  • Expecting a time component; UTC_DATE only returns the date.
  • Assuming it respects the session time zone; it always uses UTC.
  • Forgetting parentheses in code generators even though they are optional.
  • Using UTC_DATE in databases that do not support it (e.g., PostgreSQL) without an equivalent expression.

Related Topics

First Introduced In

MySQL 4.1

Frequently Asked Questions

What data type does UTC_DATE return?

It returns a DATE value, which stores only the year, month, and day. No time information is included.

Do I need parentheses when calling UTC_DATE?

Parentheses are optional in MySQL, but using them (UTC_DATE()) improves readability and avoids potential parser confusion in complex expressions.

How is UTC_DATE different from CURDATE?

CURDATE returns the current date in the session's time zone, while UTC_DATE returns the date in Coordinated Universal Time, independent of local settings.

Can I use UTC_DATE in a WHERE clause?

Yes. For example, `SELECT * FROM logs WHERE event_date = UTC_DATE();` fetches rows whose event_date column matches the current UTC date.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!