OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.3.1

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.3.1
    iconOceanBase Database
    SQL - V 4.3.1
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    TIMESTAMP WITH TIME ZONE data type

    Last Updated:2026-04-15 08:25:15  Updated
    Share
    What is on this page
    Syntax
    Parameters
    Considerations
    Examples
    DST

    folded

    Share

    The TIMESTAMP WITH TIME ZONE data type is a variant of TIMESTAMP that includes a time zone offset or time zone region (TZR) name in its value. This topic describes the syntax, parameters, and considerations of the TIMESTAMP WITH TIME ZONE data type.

    Syntax

    TIMESTAMP [(scale)] WITH TIME ZONE
    

    Parameters

    The threshold and precision of TIMESTAMP [(scale)] WITH TIME ZONE depend on the value of the scale parameter. The value range is [0,9]. The minimum value 0 indicates that the timestamp is accurate to seconds, the maximum value 9 indicates that the timestamp is accurate to nanoseconds, and the default value 6 indicates that the timestamp is accurate to microseconds.

    Considerations

    TIMESTAMP [(scale)] WITH TIME ZONE is used to store time information such as year, month, day, hour, minute, and second. The threshold and precision are determined by the value of the scale parameter. Different from TIMESTAMP [(scale)], TIMESTAMP [(scale)] WITH TIME ZONE can store time zone information and it is generally used to store datetime information across geographic regions. The value range is [0001-01-01 00:00:00.000000000,9999-12-31 23:59:59.999999999].

    The default format for the TIMESTAMP WITH TIME ZONE data type is determined by the NLS_TIMESTAMP_TZ_FORMAT parameter. Execute the following SQL statement to view the default format:

    SELECT @@NLS_TIMESTAMP_TZ_FORMAT FROM DUAL;
    

    The return result is as follows:

    DD-MON-RR HH.MI.SSXFF AM TZR
    

    You can use a conversion function to define a data format. To insert data, you can use the TO_TIMESTAMP_TZ(char,fmt) function to specify the data input format. When you want to query data, you can use the TO_CHAR(datetime,fmt) function to specify the data output format. These two conversion functions convert strings to the format specified by the fmt argument. If the fmt argument is not specified, the default format is used.

    When you insert a time zone, you can use the time zone offset and TZR to specify the time zone.

    • A time zone offset is the difference (in hour and minute) from the Greenwich Mean Time (GMT).

    • The TZR and TZD indicate the abbreviated name of a country or city. TZD represents an abbreviated form of the time zone region with Daylight Saving Time (DST) information.

    Examples

    In the following example, the timestamp value is entered by using TO_TIMESTAMP_TZ(char,fmt).

    • Insert a timestamp that has the time zone offset

      obclient> SELECT TO_TIMESTAMP_TZ('2020-01-01 11:00:00 -05:00','YYYY-MM-DD HH:MI:SS TZH:TZM') FROM DUAL;
      +-------------------------------------------------------------------------+
      | TO_TIMESTAMP_TZ('2020-01-0111:00:00-05:00','YYYY-MM-DDHH:MI:SSTZH:TZM') |
      +-------------------------------------------------------------------------+
      | 01-JAN-20 11.00.00.000000000 AM AMERICA/LOS_ANGELES                                  |
      +-------------------------------------------------------------------------+
      1 row in set
      
    • Insert a timestamp that has the TZR and TZD information

      obclient> SELECT TO_TIMESTAMP_TZ('2020-01-01 11:00:00 America/Los_Angeles PST','YYYY-MM-DD HH:MI:SS TZR TZD') FROM DUAL;
      +-------------------------------------------------------------------------+
      | TO_TIMESTAMP_TZ('2020-01-01 11:00:00 America/Los_Angeles PST','YYYY-MM-DDHH:MI:SS TZR TZD') |
      +-------------------------------------------------------------------------+
      |01-JUN-20 11.00.00.000000000 AM America/Los_Angeles PST                                  |
      +-------------------------------------------------------------------------+
      1 row in set
      

    DST

    OceanBase Database supports DST and uses TZD to indicate the DST information. Take America/Los_Angeles as an example. The Pacific Daylight Time (PDT) starts from the second Sunday of March of a year and ends on the first Sunday of November in the same year. The rest time of the year is referred to as the Pacific Standard Time (PST). When the inserted value includes only the TZR, OceanBase Database determines whether the inserted TZR is in the DST range based on the inserted time information and includes the TZD in the returned result to specify that the current time is DST.

    Here is an example:

    obclient> SELECT TO_TIMESTAMP_TZ('2020-02-01 11:00:00 America/Los_Angeles','YYYY-MM-DD HH:MI:SS TZR') FROM DUAL;
    obclient> SELECT TO_TIMESTAMP_TZ('2020-06-01 11:00:00 America/Los_Angeles','YYYY-MM-DD HH:MI:SS TZR') FROM DUAL;
    

    The return result is as follows:

    01-JUN-20 11.00.00.000000000 AM America/Los_Angeles PST
    01-JUN-20 11.00.00.000000000 AM America/Los_Angeles PDT
    

    Previous topic

    TIMESTAMP data type
    Last

    Next topic

    TIMESTAMP WITH LOCAL TIME ZONE data type
    Next
    What is on this page
    Syntax
    Parameters
    Considerations
    Examples
    DST