Link to home
Start Free TrialLog in
Avatar of leeboonseong
leeboonseong

asked on

Problem OF calculating the date/period?

Hi,
  I got a big problem.Now the problem that I facing now  is how to calculate the date.
  I to have to calculate whether there is a leap year also.
  if the day less than or equal to 7 then the period is 7 day,if more than 7 is 1 month.but if it is 1 month 1 day, it is consider to 2 month. if 2 month 1 day are 3month.and so on..the date can be more than 5 years.
  so how to calculate this one out?
  thanks for ur help.
Avatar of Microsoft
Microsoft

use the dateval command, This has different functions which run from the PC's computer calandar set into windows which handles leap years.

Im currently at work at the moment but if nobody else replys to this question and tells you how to use DATEVALUE I will explain it in more detail when I get home.

cheers
Andy
ASKER CERTIFIED SOLUTION
Avatar of vim_asteya
vim_asteya

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leeboonseong

ASKER

actually I would like to calculate how many days, and then divide into the month,
 if after minus the days is less or = 7, then the day will show 7 days, else if theday >7 but less then 1 month then consider 1 month,else if 1 month and 1 day,it willl consider 2 month...and so...thanks.of cause it will included the leap year...now i can get the day difference,


  this is what i use...
 DateDiff("d", Text4.Text, TheDate + 1)

thanks..
no I have to calculate from the date 1 to date 2, let said it is 12/2/2000 to 12/2/2001...all the date is enter by user
no I have to calculate from the date 1 to date 2, let said it is 12/2/2000 to 12/2/2001...all the date is enter by user
no I have to calculate from the date 1 to date 2, let said it is 12/2/2000 to 12/2/2001...all the date is enter by user
thnak microsoft..pls help as fast as possible
thnak microsoft..pls help as fast as possible
thnak microsoft..pls help as fast as possible
if the user enters the date use mask edit to obtain the date format.
Then u can use ur datevalue and datediff functions for ur calculations
datediff fuction returns the difference b/w dates in terms of days/months/year.
U can use them appropriately

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

u can check the MSDN for details
Otherwise,I'll paste it for u

In the interval specify
"d"- for difference in days
"m"- for difference in months
"y"- for difference in year

Date1-start date
Date2-end date
Since the user enters the date,u can use the DATEVALUE function.
Datevalue(date1) and Datevalue(Date2)
Hope this helps
I always use the DTPicker,where ever i need to use date.Why dont u use that,u will never get probs in the datevalue
thnak microsoft..pls help as fast as possible
thnak microsoft..pls help as fast as possible
I have a doubt,r my comments invisible to u?If so I need not waste my time isnt?
Avatar of DanRollins
Hi leeboonseong,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept vim_asteya's comment(s) as an answer.

leeboonseong, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with my recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer

Computer101
E-E Moderator