Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2013
    Thanked 0 Times in 0 Posts

    Last date of quarter (oracle sql)

    The following gets the first date of the current quarter:


    is there a way to get the last day?


    Last edited by vinyl-junkie; 06-17-2013 at 02:29 PM. Reason: signatures only allowed through the control panel

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,827 Times in 4,788 Posts
    I don't use Oracle, but could you do something like[code]
    TRUNC( 100 + TRUNC(sysdate,'Q'), 'Q') - 1
    That is: Get the first date of the current quarter.
    Add 100 days to that (no quarter is longer than 100 days) to get *ANY* date in the next quarter.
    Get the first date of the next quarter.
    Subtract one day from that to get the last day of the current quarter.

    You may have to use functions to add and subtract days in Oracle, but the concept should work.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Tags for this Thread

    Posting Permissions

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