date & time difference calculation

Lorry Litman LLitman@exchange.hsc.mb.ca
Tue, 18 May 2004 07:47:56 -0500


This is a multi-part message in MIME format.

--=_Part_84cfd7c5$f568$4e4b$a5dc$277bddd3a5de
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Thank-you Chris, I'll give it a try.

How do I turn the days into years, months, & days?

As an example
 difference between 30-dec-2004-10:06 and 11-oct-2003-10:30
 results in 4452336 (445 days, 23 hours, 36 minutes)
 I need the result as 0102192336 (1 year, 2 months, 19 days, 23 hours, 36
minutes)

Any suggestions?
Maybe there are different powerhouse functions I can/should use.

Thanx
    Lorry

-----Original Message-----

This e-mail and/or any documents in this transmission is intended for the=
 address(s) only and may contain legally privileged or confidential infor=
mation. Any unauthorized use, disclosure, distribution, copying or dissem=
ination is strictly prohibited. If you receive this transmission in error=
, please notify the sender immediately and return the original.
--=_Part_84cfd7c5$f568$4e4b$a5dc$277bddd3a5de
Content-Type: message/rfc822
Content-Transfer-Encoding: 8bit

From: Chris Sharman [mailto:chris.sharman@ccagroup.co.uk]
Sent: Tuesday, May 18, 2004 3:37 AM
To: powerh-l@lists.sowder.com
Subject: Re: date & time difference calculation
MIME-Version: 1.0


Chris Sharman wrote:
> def fdays = absolute(decimaltime(vmsdt1,vmsdt2))
> def idays int*4 = floor(fdays)
> def ihours int*2 = floor((fdays - idays)*24)
> def imins int*2 = floor(((fdays - idays)*24 - ihours)*60)
> def idiff int*9 = idays*10000+ihours*100+imins if (vmsdt1>=vmsdt2) &
>     else -(idays*10000+ihours*100+imins)
> rep all
> go
> 

Better still, thinking about it, is to do the rounding first, before 
breaking down into days, hours, and minutes.

def xmins int*9 = 1440 * absolute(decimaltime(vmsdt1,vmsdt2)) + 0.5
def idays int*4 = xmins/1440
def ihours int*2 = xmins/60 - 24*idays
def imins int*2 = xmins - 60*(ihours + 24*idays)

Chris


-----------------------------------------------------------------------

Any views expressed in this message are those of the sender and not
necessarily those of CCA Group.  The unauthorized use, disclosure,
copying or alteration of this message is forbidden.  The contents of
this message may be confidential and/or privileged, copyright CCA Group
and are intended solely for the use of the individual or entity to whom
they are addressed.  Whilst this message has been scanned, CCA Group
cannot guarantee that it is virus free or compatible with your systems
and accepts no responsibility for any loss or damage arising from its
use. The recipient is advised to run their own anti-virus software. If
you receive this message in error please contact
postmaster@ccagroup.co.uk immediately, destroy any copies and delete it
from your computer systems.
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.sowder.com
Subscribe: "subscribe" in message body to powerh-l-request@lists.sowder.com
Unsubscribe: "unsubscribe <password>" in message body to
powerh-l-request@lists.sowder.com
http://lists.sowder.com/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.
--=_Part_84cfd7c5$f568$4e4b$a5dc$277bddd3a5de--