[AccessD] Dividing days into years and months

Scott Marcus marcus at tsstech.com
Wed Jul 28 06:26:44 CDT 2004


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







More information about the AccessD mailing list