>Hi,
>
[quoted text clipped - 19 lines]
>
>What am I doing wrong?
DateDiff returns a value in integer seconds, minutes, years or
whatever argument you pass. If you use the "n" argument, you'll get
integer minutes: 0:0:00 to 0:0:29 will give 0, to 0:0:30 will give 1.
To get seconds, and display them as hours:minutes:seconds, use
DateDiff("s", [PriorTime], [Time]) \ 3600 & ":" & Format(DateDiff("s",
[PriorTime], [Time]) \ 60 MOD 60, "00") & ":" & Format(DateDiff("s",
[PriorTime], [Time]) MOD 60, "00")
Thus if Charmus is behind by 3664 seconds, you'll see 1:01:04.
John W. Vinson[MVP]
John Spencer - 25 Dec 2005 23:19 GMT
Quibble,
DateDiff has always just given me boundaries crossed. So minutes between
00:00:00 to 00:00:59 returns 0 not 1.
> >Hi,
> >
[quoted text clipped - 33 lines]
>
> John W. Vinson[MVP]
John Vinson - 26 Dec 2005 05:39 GMT
>Quibble,
>
>DateDiff has always just given me boundaries crossed. So minutes between
>00:00:00 to 00:00:59 returns 0 not 1.
Thanks John - right you are of course!
John W. Vinson[MVP]
Neil Grantham - 29 Dec 2005 09:17 GMT
Thanks John, just what I needed.
Of course the first will be need to be blank, and at the moment just
returns :: so can I build in something to make it 00:00:00?
Thanks
Neil
> >Hi,
> >
[quoted text clipped - 33 lines]
>
> John W. Vinson[MVP]
John Vinson - 29 Dec 2005 19:44 GMT
>Thanks John, just what I needed.
>Of course the first will be need to be blank, and at the moment just
>returns :: so can I build in something to make it 00:00:00?
Use
NZ(DateDiff(...)) in place of just plain DateDiff.
John W. Vinson[MVP]
Neil Grantham - 31 Dec 2005 01:01 GMT
Thanks once again John,
This forum has proved most helpful.
For the record, I modified the statement slightly to this:
Diff: Format(nz(DateDiff("s",[PriorTime],[Time])\3600,0) Mod 60,"+00")
& ":" & Format(nz(DateDiff("s",[PriorTime],[Time])\60,0) Mod 60,"00") &
":" & Format(nz(DateDiff("s",[PriorTime],[Time]),0) Mod 60,"00")
as I wanted 2 leading zero's and a + sign
Thanks again
Neil
> >Thanks John, just what I needed.
> >Of course the first will be need to be blank, and at the moment just
[quoted text clipped - 5 lines]
>
> John W. Vinson[MVP]