CURRENT_TIMESTAMP Function - Oracle to MySQL Migration

In Oracle, the CURRENT_TIMESTAMP function returns the current date and time with fractional seconds and with the time zone (TIMESTAMP WITH TIME ZONE data type) in the session time zone.

In MySQL, you can also use the CURRENT_TIMESTAMP function, which returns the value in the session time zone but does not include the time zone.

Note that in Oracle, CURRENT_TIMESTAMP(p) has the default precision of 6 (microseconds), whereas in MySQL, it has the default precision of 0 (seconds).

Oracle:

  -- Get the current date and time with time zone 
  SELECT CURRENT_TIMESTAMP FROM dual;
  /* 09-JAN-26 12.29.03.794000 PM +01:00 */

MySQL:

  -- Get the current date and time (no time zone information), seconds fractional precision by default
  SELECT CURRENT_TIMESTAMP;
  /* 2026-01-09 12:29:03 */
 
  -- Microseconds precision
  SELECT CURRENT_TIMESTAMP(6);
  /* 2026-01-09 12:29:03.794789 */

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';
 
  -- SYSTIMESTAMP uses database OS time zone, while CURRENT_TIMESTAMP uses session time zone
  SELECT SYSTIMESTAMP, CURRENT_TIMESTAMP FROM dual;

Result:

SYSTIMESTAMP CURRENT_DATE
09-JAN-26 12.29.03.794000 PM +01:00 09-JAN-26 06.29.03.794000 AM -05:00

You can see that SYSTIMESTAMP 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_TIMESTAMP 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 CURRENT_TIMESTAMP, TIMEDIFF(CURRENT_TIMESTAMP, UTC_TIMESTAMP);
  /* 2026-01-09 12:29:03      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 CURRENT_TIMESTAMP, TIMEDIFF(CURRENT_TIMESTAMP, UTC_TIMESTAMP);
  /* 2026-01-09 06:29:03      -05:00:00 */

For more information, see Oracle to MySQL Migration.