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

  • SEARCH
  • Home
  • 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 6559421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:19:29+00:00 2026-05-25T13:19:29+00:00

I have a strange format that I need to convert to an Oracle Timestamp

  • 0

I have a strange format that I need to convert to an Oracle Timestamp (no fractal seconds needed). I have two columns, date_entered, and time_entered, that have this format from our AS/400:

1110729 954
1110811 1216
1110815 1526
1110815 1659
1110817 1007
1110818 1000
1110821 1715
1110822 1320
1110823 1852
1110825 1743
1110826 1100
1110826 1559
1110826 1711
1110826 1906

The Date Column is an AS/400 date, with the 1st character as a y2k mark YYYMMDD. All dates are actually above year 2000, so that 1st character can be disregarded if needed.

Also, as you can see my time_entered field is a 24-hour timstamp, however it is a “number” field, so 3-digit rows are possible. I would like to write a SQL statement to convert this to an Oracle Timestamp. Not a function or anything, but just select statement to select the datetime of these two columns combined.

  • 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-05-25T13:19:30+00:00Added an answer on May 25, 2026 at 1:19 pm

    I have an Oracle instance and Sparky is correct with just a few minor modifications. Need to change the ‘+’ to ‘||’ and also need to change the ‘hh’ to ‘HH24’:

    TO_TIMESTAMP(SUBSTR(datefield,2)||LPAD(timefield,4,'0'),'YYMMDDHH24MI')
    

    Sample shown below:

    SQL> describe oldvalues2
     Name                                     Null?    Type
     ---------------------------------------- -------- ----------------------------
     DATEVAL                                           VARCHAR2(7)
     TIMEVAL                                           VARCHAR2(4)
    
    SQL> select * from oldvalues2
      2  /
    
    DATEVAL TIME
    ------- ----
    1110729 954
    1110826 1906
    
    SQL> select to_timestamp(substr(DATEVAL,2)||lpad(TIMEVAL,4,'0'),'YYMMDDHH24MI')
      2  from oldvalues2
      3  /
    
    TO_TIMESTAMP(SUBSTR(DATEVAL,2)||LPAD(TIMEVAL,4,'0'),'YYMMDDHH24MI')
    ---------------------------------------------------------------------------
    29-JUL-11 09.54.00.000000000 AM
    26-AUG-11 07.06.00.000000000 PM
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java application that stores some GPS data in a strange format:
I have a strange, sporadic issue. I have stored procedure that returns back 5
This is kind of a strange one. I have a CSV that I'm uploading
I have come accross a strange problem that can be illustrated using the 2
I have a bit of a strange problem with MySQL that I've never seen
I have a very strange issue that I cannot explain. I have my base
I have a onclick event in JavaScript that I have chosen to format as
I have a strange issue that I'm baffled with but I'm sure someone in
I have a rather strange problem. I have a very simple application that reads
Hey guys, I'm getting a really strange error. I have a program that needs

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.