If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Informix Date Functions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-24-02, 04:02
unamc unamc is offline
Registered User
 
Join Date: Jul 2002
Posts: 2
Informix Date Functions

Hi

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

Can any one help?

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-24-02, 10:54
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
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/
Reply With Quote
  #3 (permalink)  
Old 07-25-02, 05:57
unamc unamc is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 07-25-02, 08:05
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
hey, neat

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

Reply With Quote
  #5 (permalink)  
Old 08-28-03, 14:27
eatCode eatCode is offline
Registered User
 
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...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On