Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:57:33+00:00 2026-06-15T15:57:33+00:00

How do I convert a date/timeztamp from one timezone to another timezone in an

  • 0

How do I convert a date/timeztamp from one timezone to another timezone in an Oracle SQL stored procedure? The DB server is set to use GMT, as is the machine which connects to the DB, but the data must be saved in CST or CDT, depending on whether it is daylight savings time or not.

I have this SQL working:

select to_char(from_tz(TO_TIMESTAMP(to_char(SYSDATE,'mm-dd-yyyy hh24:mi:ss'), 'mm-dd-yyyy hh24:mi:ss'),'GMT')  at time zone 'CST6CDT','mm-dd-yyyy hh24:mi:ss') from dual;

But when I put it into a procedure, it fails with this error: ORA-01843: not a valid month

This is what I have for the procedure:

declare 
p_systemDT TIMESTAMP WITH TIME ZONE;
BEGIN
select to_char(from_tz(TO_TIMESTAMP(to_char(SYSDATE,'mm-dd-yyyy hh24:mi:ss'), 'mm-dd-yyyy hh24:mi:ss'),'GMT')  at time zone 'CST6CDT','mm-dd-yyyy hh24:mi:ss')  into p_systemDT  from dual;
DBMS_OUTPUT.PUT_LINE('p_systemDT = ' || p_systemDT);
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:57:34+00:00Added an answer on June 15, 2026 at 3:57 pm

    First, you can use SYSTIMESTAMP to return a TIMESTAMP WITH TIME ZONE (in my case, the server is running in the US/Eastern time zone which is 5 hours behind GMT) so you don’t have to take SYSDATE and convert it to a timestamp

    SQL> select systimestamp
      2    from dual;
    
    SYSTIMESTAMP
    ---------------------------------------------------------------------------
    10-DEC-12 12.39.51.755000 PM -05:00
    

    You can then convert SYSTIMESTAMP to whatever time zone you want (‘CST6CDT’ in this case)

    SQL> ed
    Wrote file afiedt.buf
    
      1  select systimestamp at time zone 'CST6CDT'
      2*   from dual
    SQL> /
    
    SYSTIMESTAMPATTIMEZONE'CST6CDT'
    ---------------------------------------------------------------------------
    10-DEC-12 11.40.14.491000 AM CST6CDT
    

    And then if you want to specify the format of the string, you can add a to_char

    SQL> ed
    Wrote file afiedt.buf
    
      1  select to_char( systimestamp at time zone 'CST6CDT', 'mm-dd-yyyy hh24:mi:ss' )
      2*   from dual
    SQL> /
    
    TO_CHAR(SYSTIMESTAM
    -------------------
    12-10-2012 11:40:48
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To convert a date from string to Unix time, I can use date --date
How to convert a date string Mon, 24 May 2010 17:54:00 GMT from RSS
I need to convert a date and time (GMT) into a timestamp with php.
I'm trying to convert date formats in javascript. I get a string from a
I have an Excel file (which has data imported from Oracle 10G Database) one
Is there a quick, one-liner way to convert a Unix timestamp to a date
I need to convert a date from a string (entered into a url) in
I have a date that I get from a server formatted in EST like
I have a date from a server in format 01/01/2012 12:00:00PM and I want
How do I convert this timestamp from php into a javascript Date() object? This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.