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 7577661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:14:44+00:00 2026-05-30T17:14:44+00:00

I am trying to create a function that can subtract between 2 dates but

  • 0

I am trying to create a function that can subtract between 2 dates but I am having some issues:

Firstly with the storing of the date, and secondly with the function.

Here is my code for storing the date in to a table:

CREATE TABLE car_info
  (
   car_id NUMBER(4)
   arrival DATE,
   departure DATE
   ......
  )

here I have saved the arrival/departure times as DATES. Ideally I will want it in the format of dd-mon-yyy-hh-mm-ss

This is where I encounter my first problem:

INSERT INTO car_info 
VALUES('0001', to_date('12-jun-2006 06:00:01'), to_date('14-jun-2006 09:00:01')

From the research I have done, this seems correct?

however if I do a SELECT * FROM car_info, this is the result:

car_id       arrival_date      departure_date
   1          12-jun-2006        14-jun-2006

Does anyone know why it is not displaying the result as a full date and time?

To stop this post getting too full of information, once I have this problem solved I will post my issues with the function.

Thanks for any help

kihd regards, Darren

Second part of question has been moved to Oracle sql – date subtraction within a function

  • 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-30T17:14:45+00:00Added an answer on May 30, 2026 at 5:14 pm

    DATE in Oracle is a point in time, it is not stored with a format. A format is chosen when the date is displayed so that it can be understood by humans.

    DATE by default will be displayed as per your NLS_DATE_FORMAT setting. You can change this setting with the following command:

    ALTER SESSION SET NLS_DATE_FORMAT='dd-mon-yyyy hh24:mi:ss';
    

    You could also ask for an explicit format by using TO_CHAR in your query:

    SELECT to_char(arrival, 'dd-mon-yyyy hh24:mi:ss')
      FROM car_info
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a function that will block access to some of
My friend is trying to create a utility function that is given some Type
I am trying to create a function that can convert a month number to
I'm trying to create a universal function that I can call from multiple places
I'm trying to create ONE javascript function that can do the following: onclick, a
I'm trying to create a jquery function that can be called both on ready
I'm trying to create a function that can format a number with the minimum
I'm trying to create a function that I can apply to a div, and
I'm trying to create a function that i can use over and over. I
I'm trying to create a custom function that I can place in a queryset

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.