SYSTIMESTAMP Function - Oracle to MySQL Migration

In Oracle, the SYSTIMESTAMP function returns the current date and time with fractional seconds and with the time zone (TIMESTAMP WITH TIME ZONE data type) for the database server's host operating system.

In MySQL, you can use the NOW(6) function, which returns the value in the session time zone and does not include the time zone.

Oracle:

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

MySQL:

  -- Get the current date and time (no time zone information)
  SELECT NOW(6);
  /* 2026-01-09 12:29:03.794000 */

SYSTIMESTAMP Time Zone in Oracle

In Oracle, SYSTIMESTAMP returns the date and time in the time zone of the database instance's operating system:

Oracle:

  ALTER SESSION SET TIME_ZONE = '-05:00';
 
  -- Get the session and database time zones
  SELECT SESSIONTIMEZONE, DBTIMEZONE FROM dual;
  /* -05:00   +00:00 */
 
  -- SYSDATE, SYSTIMESTAMP uses database OS time zone, while CURRENT_DATE uses session time zone
  SELECT SYSTIMESTAMP, CURRENT_TIMESTAMP FROM dual;

Result:

SYSTIMESTAMP CURRENT_TIMESTAMP
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.

NOW() Time Zone in MySQL

In MySQL, NOW() returns the date and time in the session time zone.

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 */
 
  -- If session time zone is SYSTEM, you can define the database server time zone
  SELECT NOW(6), TIMEDIFF(NOW(), UTC_TIMESTAMP);
  /* 2026-01-09 12:29:03.794000      01:00:00 */

If the session time zone is changed, you can use the CONVERT_TZ function to get the current date and time in the database server time zone:

MySQL:

  -- Change the session time zone
  SET TIME_ZONE = '-05:00';
 
  -- NOW() now returns time in the session time zone
  SELECT NOW(6), TIMEDIFF(NOW(), UTC_TIMESTAMP);
  /* 2026-01-09 06:29:03.794000      -05:00:00 */
 
  -- Get the current date and time in the database server time zone
  SELECT CONVERT_TZ(NOW(6), @@SESSION.time_zone, 'SYSTEM'); 
  /* 2026-01-09 12:29:03.794000 */

For more information, see Oracle to MySQL Migration.