Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Nandkishor Lande
  Where is Nandkishor Lande?
 Pune
 India
 Nandkishor Lande
 Tags
Subject: RE: Half Month Calculation
Thread ID: 310784 Message ID: 310785 # Views: 32 # Ratings: 1
Version: Visual FoxPro 9 Category: Forms
Date: Friday, June 24, 2011 12:20:49 PM         
   


> I Have a question
> i have record of one month
> i want to calculate in two part
> 1 to 15 .and. 16 to 30
> i using this code to
>
>
> select * from trans where between(date,dt1,dt2) order by date into cursor x
> &&I want query to all records how to part month in half
> some months have 30 days some months have 31 days and february have 28/29 days how to do it
> 



CREATE CURSOR theTable (theDate D)
INSERT INTO theTable VALUES (DATE(2011,6,2))
INSERT INTO theTable VALUES (DATE(2011,6,24))
SELECT * FROM theTable WHERE DAY(theDate) Between 1 AND 15
SELECT * FROM theTable WHERE DAY(theDate) > 15

INSERT INTO theTable VALUES (DATE(2011,6,15))
SELECT * FROM theTable WHERE DAY(theDate) Between 1 AND 15
SELECT * FROM theTable WHERE DAY(theDate) > 15


Since only 30-days and 28-day months can be divided into two equal parts, I'd just keep the "15", i.e. do it as most banks do it AFAIK: they simply say each month has 30 days, so that a year has 360 days, for instance when they are calculating interests in Switzerland. That way they are missing a lot of birthday parties of course.



hth
-Stefan

ENTIRE THREAD

Half Month Calculation Posted by Nandkishor Lande @ 6/24/2011 12:02:14 PM
RE: Half Month Calculation Posted by Stefan Wuebbe @ 6/24/2011 12:20:49 PM