Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2002
    Posts
    2

    Unanswered: Informix Date Functions

    Hi

    I am looking for the equivalent of 'LAST_DAY' function (Oracle) in Informix.

    Can any one help?

    Thanks

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i don't use informix but a quick search of their online docs turned up the MDY() function that can be adapted to what you want

    use the expression MDY(MONTH(TODAY),28,YEAR(TODAY)) + INTERVAL (4) DAY to put you into the next month

    use MDY(MONTH(XX),1,YEAR(XX)) to get the first day of the next month (where XX is the expression above) and then subtract 1 day

    not pretty, but i think that'll do it

    rudy
    http://rudy.ca/

  3. #3
    Join Date
    Jul 2002
    Posts
    2
    HI Rudy

    Thanks for you suggestion but have come up with more tidy
    peace of code. If you are interested here is the solution I am
    using:

    MDY(MOD(Month(today)+1,12),1,year(today)) -1 units day

    Thanks again for you help

    Una

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    hey, neat

    you sure that'll work in december? i think you might end up with december 31 of the previous year, eh?


  5. #5
    Join Date
    Aug 2003
    Posts
    1

    another date code

    There is one more way......

    ((TODAY) + 1 UNITS MONTH - (DAY(TODAY)) UNITS DAY)
    as LSTDAYOFMNTH

    this will eliminate the problem when you hit december...

Posting Permissions

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