CURRENT_DATE Function - Oracle to MySQL Migration

In Oracle, the CURRENT_DATE function returns the current date and time in the session time zone at the statement execution time.

In MySQL, you can use the NOW() function, which also includes the time and returns the value in the session time zone at the statement execution time.

Note that MySQL also has the CURRENT_DATE function, but it returns only the date (no time).

Oracle:

  ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';
 
  -- Get the current date and time
  SELECT CURRENT_DATE FROM dual;
  /* 2026-01-08 14:28:52 */

MySQL:

  -- Get the current date and time
  SELECT NOW();
  /* 2026-01-08 14:28:52 */
 
  -- Date only returned
  SELECT CURRENT_DATE;
  /* 2026-01-08 */

Default Session Time Zone in Oracle

By default, Oracle client applications tend to set the session time zone to the client's operating system time zone immediately after the connection is established; however, you should verify this behavior with your application.

Oracle:

  ALTER SESSION SET TIME_ZONE = '-05:00';
 
  -- SYSDATE, SYSTIMESTAMP uses database OS time zone, while CURRENT_DATE uses session time zone
  SELECT SYSDATE, SYSTIMESTAMP, CURRENT_DATE FROM dual;

Result:

SYSDATE SYSTIMESTAMP CURRENT_DATE
2026-01-08 14:28:52 2026-01-08 14:28:52.524000 PM +01:00 2026-01-08 08:28:52

You can see that SYSDATE (the time zone can be seen in the SYSTIMESTAMP result) returned the current time in UTC +01:00 time zone (database OS time zone), even though the session time zone was set to UTC -05:00 and the database time zone is UTC +00:00.

Meanwhile, CURRENT_DATE returned the value in the session time zone UTC -05:00.

Default Session Time Zone in MySQL

By default, the MySQL session time zone is set to SYSTEM, meaning it is the same as the database instance time zone.

MySQL:

  -- Get system and session time zone
  SELECT @@GLOBAL.time_zone, @@SESSION.time_zone;
  /* SYSTEM     SYSTEM */
 
  -- You can define your session time zone
  SELECT NOW(), TIMEDIFF(NOW(), UTC_TIMESTAMP);
  /* 2026-01-08 14:28:52      01:00:00 */

When the session time zone changes, NOW() returns the current date and time using that time zone:

MySQL:

  -- Change the session time zone
  SET TIME_ZONE = '-05:00';
 
  -- NOW() reflects the new time zone
  SELECT NOW(), TIMEDIFF(NOW(), UTC_TIMESTAMP);
  /* 2026-01-08 08:28:52      -05:00:00 */

Execution Time in Oracle

Oracle returns the current date and time at the statement execution time:

Oracle:

  WITH FUNCTION SLEEP_CURRENT_DATE(i NUMBER)
  RETURN DATE IS
  BEGIN
    DBMS_SESSION.SLEEP(i);
    RETURN CURRENT_DATE;
  END;
  SELECT CURRENT_DATE, SLEEP_CURRENT_DATE(3), CURRENT_DATE FROM dual
  UNION ALL
  SELECT CURRENT_DATE, SLEEP_CURRENT_DATE(3), CURRENT_DATE FROM dual;
  /

Result:

CURRENT_DATE SLEEP_CURRENT_DATE(3) CURRENT_DATE
2026-01-08 08:28:52 2026-01-08 08:28:55 2026-01-08 08:28:52
2026-01-08 08:28:52 2026-01-08 08:28:58 2026-01-08 08:28:52

You can observe that all four CURRENT_DATE calls in the query returned the same result, whereas two CURRENT_DATE calls in the user-defined function returned different results (after a delay).

Execution Time in MySQL

In MySQL, NOW() returns the current date and time at the statement execution time, while SYSDATE() returns the time at which the function executes.

MySQL:

  -- Get the current date and time multiple times with a delay in the same query
  SELECT NOW(), SYSDATE(), SLEEP(3), NOW(), SYSDATE();

Result:

NOW() SYSDATE() SLEEP(3) NOW() SYSDATE()
2026-01-08 08:28:52 2026-01-08 08:28:52 0 2026-01-08 08:28:52 2026-01-08 08:28:55

You can observe that NOW() returned the same value, while SYSDATE() returned different values.

For more information, see Oracle to MySQL Migration.