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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:59:33+00:00 2026-06-14T13:59:33+00:00

I would like to ask how do i check if the difference between two

  • 0

I would like to ask how do i check if the difference between two dates.

  1. BillingDate which is a date type with an entry ‘DD-MON-YYYY’

  2. and the other date is the current date.

sys_date - BillingDate = daysFromBilled

alot of the examples i find they actually stated the second date to calculate the difference but what i am looking for is the difference between the current date so i can add it into a schedule or job.

i am using oracle btw.


Another point to add, i will continue to search, but if your could also recommend, how should i implement such a function:

  1. Calculate date difference from all BillingDate entries
  2. To trigger an alter table if the difference is more than 30 days to put Status as Late.
  3. If Status is more than 60 days the Service attribute will be altered and changed to Cut

here is my rough table layout

Cust             Billing
--------         ----------
CustID(PK)       BillingID(PK)
LateStatus       LateStatus
Service          BillingDate
                 CustID

Thanks alot.

Update

REPLACE view DateDifference as
select trunc(sysdate)- trunc(BillingDate)
from Billing;

seems legit.

  • 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-14T13:59:35+00:00Added an answer on June 14, 2026 at 1:59 pm

    Simply subtract one date from the other:

    BillingDate - sysdate
    

    To do that in a select statement, just use it like this:

    select billingdate - sysdate as daysFromBilled
    from ...
    

    Inside a trigger you use a regular assignment operator:

    declare
        daysFromBilled integer;
    
    begin 
        daysFromBilled := :new.billingdate - sysdate;
    ...
    

    that will return the number of days, including fractional values if the time is different (a DATE column in Oracle also contains a time!).

    If you only want to get full days, use this:

    trunc(BillingDate) - trunc(sysdate)
    

    This statement of yours:

    date type with an entry ‘DD-MON-YYYY’

    Indicates a misunderstanding on how DATE values work.

    A DATE (or TIMESTAMP) does not have any format.

    They are stored in binary form in your column. The format is only applied when you display the value and thus convert it to a character literal. That is the work of the client application you use to display the values. SQL*Plus uses the NLS settings, other SQL tools might use a different configuration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would just like to ask what is the difference between user_constraints and user_objects
I would like to ask such question, I have XML xsd`s, which generate beans
I would like to ask, which method has been called whenever the user quit
I would like to ask for help with this, I wanted to check for
I would like two how to do to share Resources files between 2 (or
Hello everyone I would like to ask how to check value's length from textbox
Would like to ask is there a tool in xcode whereby it will check
I would like ask if there's a way to download an android layout from
What I would like ask is best illustrated by an example, so bear with
I would like to ask you: Imagine that you have a site and there

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.