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 > datetime +- inbtervals

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-09-06, 10:00
supinformix supinformix is offline
Registered User
 
Join Date: Apr 2004
Location: Brussels
Posts: 57
datetime +- inbtervals

How to calculate CORRECTLY with intervals :

when the date1 = '31/01/2006'
then "select date1 - 1 units month .. " results in '31/12/2005'
tht's fine

but
with " select date1 - 2 units month .. " results in
" The result of a datetime computation is out of range"
because '31/10/2005' doesn't exists

the same with "31/01/2006" + 1 units month
How to calculate correctly ??
__________________
Yves & Willy
Reply With Quote
  #2 (permalink)  
Old 02-09-06, 10:50
nitin_math nitin_math is offline
Registered User
 
Join Date: Nov 2004
Posts: 143
Hi,

If you are concerned with only last dates of the month, then may be you can use the following:

select -- n months previous end day (eg below is 4 months) -- ( biggest frig comparred to the others)
current year to day -3 units month - (day(current)) units day as prevN_month_end

from systables
where tabname = 'systables'


Bye

Nitin
Reply With Quote
  #3 (permalink)  
Old 02-14-06, 02:27
supinformix supinformix is offline
Registered User
 
Join Date: Apr 2004
Location: Brussels
Posts: 57
Hi,

yes, like to be a ,right answer.

Thanks
Yves
__________________
Yves & Willy
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