Home > Archive > Visual Basic Syntax > February 2006 > datediff
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Sheldon 2006-02-21, 7:04 pm |
| I am trying to use the datediff function as follows
DateDiff("h", mdtDate1, mdtDate2)
I am looking for hours in the format of h.h
That is not rounded off to whole hours, and not h:mm, just hours and
fractions of hours.
All I get is whole numbers.
Any help would be appreciated.
Thanks
Sheldon
| |
| Karl E. Peterson 2006-02-21, 7:04 pm |
| Sheldon wrote:
> I am trying to use the datediff function as follows
>
> DateDiff("h", mdtDate1, mdtDate2)
>
> I am looking for hours in the format of h.h
> That is not rounded off to whole hours, and not h:mm, just hours and
> fractions of hours.
>
> All I get is whole numbers.
> Any help would be appreciated.
I think that's what you get, with that function. You could subtract its
return from the original value, and divide that by 60 to get the fractional
part.
--
Working without a .NET?
http://classicvb.org/
| |
| Rick Rothstein [MVP - Visual Basic] 2006-02-21, 7:04 pm |
| > I am trying to use the datediff function as follows
>
> DateDiff("h", mdtDate1, mdtDate2)
>
> I am looking for hours in the format of h.h
> That is not rounded off to whole hours, and not h:mm, just hours and
> fractions of hours.
>
> All I get is whole numbers.
That is what the DateDiff function returns. You can use the next lower time
interval and divide up to then desire time interval. In your case, that
would be to find the DateDiff for minutes ("n") and divide by 60...
DateDiff("n", mdtDate1, mdtDate2) / 60
Rick
| |
| Karl E. Peterson 2006-02-21, 7:04 pm |
| Rick Rothstein [MVP - Visual Basic] wrote:
>
> That is what the DateDiff function returns. You can use the next
> lower time interval and divide up to then desire time interval. In
> your case, that would be to find the DateDiff for minutes ("n") and
> divide by 60...
>
> DateDiff("n", mdtDate1, mdtDate2) / 60
Better approach, that.
--
Working without a .NET?
http://classicvb.org/
|
|
|
|
|