[AccessD] Dividing days into years and months

Arthur Fuller artful at rogers.com
Wed Jul 28 11:27:54 CDT 2004


While on this subject, I'd like to poll the readers for their clients'
typical definition of a month. In my case, all clients interpret a month
to mean "increment the month number while preserving the day number; if
the month is 12, go to 1 and increase the year number". However, some of
my clients break this rule when the day in question is EoM(): in that
case they want to go to the next EoM(); i.e., the next date following
Feb 29, 2004 is March 31, 2004; and conversely, the next date after Jan
31, 2004 is Feb 29, 2004.

Any other non-logical variants?

Arthur

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Scott Marcus
Sent: Wednesday, July 28, 2004 7:27 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Dividing days into years and months


Andy,

The problem with DateDiff is that
DateDiff("yyyy",#12/31/2003#,#1/1/2004#) = 1, which is hardly 1 year.

Years would be DateDiff("d",begindate,enddate)/365
Months would be (DateDiff("d",begindate,enddate)/365)*12
Weeks would be (DateDiff("d",begindate,enddate)/365)*52 or
DateDiff("d",begindate,enddate)/7 Days would be
DateDiff("d",begindate,enddate)

Scott Marcus
TSS Technologies, Inc.
marcus at tsstech.com
(513) 772-7000

 -----Original Message-----
From: 	accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]  On Behalf Of Andy Lacey
Sent:	Wednesday, July 28, 2004 7:10 AM
To:	Access Developers discussion and problem solving
Subject:	Re: [AccessD] Dividing days into years and months

Hi Paul

I'm guessing here but it sounds like you're talking about the number of
years etc between two dates. If that's true then check out the DateDiff
function and DateAdd functions. What you could do then is calc the
DateDiff in years, use DateAdd to add that number of years back onto
your first date then get the DateDiff between the new date and the
original last date in Months, then repeat to get the remaining number of
days.

If I've misinterpreted what you want I'm sorry. If I'm right but you
need more help let me/us know.


--
Andy Lacey
http://www.minstersystems.co.uk



--------- Original Message --------
From: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
To: 'Access Developers discussion and problem solving'
<accessd at databaseadvisors.com>
Subject: [AccessD] Dividing days into years and months
Date: 28/07/04 07:55

>
> Dear Experts
>
> I can divide in Access the days from a date() into years with a simple

> /365, but is there a way to have months and days ... so I have years,
months
> and days, please?
>
> Cheers paul
>
> --
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
>
>
>
>

________________________________________________
Message sent using UebiMiau 2.7.2

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list