CONVERT_TZ

Converts a given datetime object from one timezone to another.

Syntax

CONVERT_TZ (dateobj, oldtz, newtz)

Arguments

  • date_obj: A valid DATE, DATETIME, or parseable date string.

  • old_tz and new_tz: Any valid timezone identifier.

Important

Timezone identifiers may be explicit intervals or named zones. Explicit intervals are in the form +10:00 or -3:30 and are counted from UTC. Named timezones are in the form America/Mazatlan or EST.

The list of supported timezone names is derived from https://www.iana.org/time-zones.

A copy of the timezones list is included in a text file -- memsql_timezones.txt -- in the share directory of your SingleStore installation directory. The timezone names are not derived from any settings on the host operating system.

Return Type

A DATE or DATETIME object. If date_obj, old_tz, or new_tz is not valid, returns NULL.

Examples

SELECT CONVERT_TZ('2014-04-18 12:00:00','GMT','EST');
+-----------------------------------------------+
| CONVERT_TZ('2014-04-18 12:00:00','GMT','EST') |
+-----------------------------------------------+
| 2014-04-18 07:00:00                           |
+-----------------------------------------------+
SELECT CONVERT_TZ('2014-04-18 12:00:00','GMT','-3:14');
+-------------------------------------------------+
| CONVERT_TZ('2014-04-18 12:00:00','GMT','-3:14') |
+-------------------------------------------------+
| 2014-04-18 08:46:00                             |
+-------------------------------------------------+

Last modified: May 31, 2023

Was this article helpful?

Verification instructions

Note: You must install cosign to verify the authenticity of the SingleStore file.

Use the following steps to verify the authenticity of singlestoredb-server, singlestoredb-toolbox, singlestoredb-studio, and singlestore-client SingleStore files that have been downloaded.

You may perform the following steps on any computer that can run cosign, such as the main deployment host of the cluster.

  1. (Optional) Run the following command to view the associated signature files.

    curl undefined
  2. Download the signature file from the SingleStore release server.

    • Option 1: Click the Download Signature button next to the SingleStore file.

    • Option 2: Copy and paste the following URL into the address bar of your browser and save the signature file.

    • Option 3: Run the following command to download the signature file.

      curl -O undefined
  3. After the signature file has been downloaded, run the following command to verify the authenticity of the SingleStore file.

    echo -n undefined |
    cosign verify-blob --certificate-oidc-issuer https://oidc.eks.us-east-1.amazonaws.com/id/CCDCDBA1379A5596AB5B2E46DCA385BC \
    --certificate-identity https://kubernetes.io/namespaces/freya-production/serviceaccounts/job-worker \
    --bundle undefined \
    --new-bundle-format -
    Verified OK