Results 1 to 4 of 4

Thread: date help

  1. #1
    Join Date
    Nov 2009
    Posts
    8

    Unanswered: date help

    hello. I'm running into some problems here. I have 2 dates
    '15-DEC-2008','15-DEC-2011'. What i need is to
    get a return value of '3' meaning years.

    Eventually im going to need to figure out how to break it down into months
    too as im trying to calculate debts owed and payments expected.

    This is beyond what we covered in class. It was a 15 week deal and i understand as much as we covered but we never got to cast. Bottom line is I have this database and there are a few logical equations i would like to perform. I figured out what i need to do but we never got into the commands that i need in order to do them.

    SELECT cast ( SUPERVISION_START - SUPERVISION_END AS INTEGER ) AS 'TOTAL SUPERVISION'
    FROM PROBATIONER
    WHERE DEF_ID = 'D001'
    the values are in datetime

    This returned -1095. Im going to assume that is the total days between the
    two dates which is great but not what i need

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try the DATEDIFF() function.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Nov 2009
    Posts
    8
    Thanks a million. It worked

  4. #4
    Join Date
    Nov 2009
    Posts
    8
    ok im gettin it
    Last edited by abcs; 12-04-09 at 19:52.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •