|
-
Apr 18th, 2001, 01:24 AM
#1
Thread Starter
New Member
Hi, I'm new to VB--I would like to know how to subtract between time periods i.e. In 8:35am Out 11:40am and I would have to do this for at least 5 different times in one day (Employee Time Sheet).
Any help would be greatly appreciated thanks,
JT
-
Apr 18th, 2001, 02:00 AM
#2
Frenzied Member
I would convert it all to minutes, do the subtraction, and then back to hours
NXSupport - Your one-stop source for computer help
-
Apr 18th, 2001, 05:35 AM
#3
transcendental analytic
The datediff function returns the difference between to dates in specified time intervals
difference = DateDiff(interval, date1, date2)
where interval can be:
Code:
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 18th, 2001, 08:49 AM
#4
Addicted Member
Be careful with datediff:
It will return 1 day, one hour or one minute between 1 second to midnight and one second after midnight.
If this period extends over 31st December - 1st January then datediff returns one year, although if you ask for the result in seconds the result is two seconds as expected.
It all depends on the size of the interval.
On a timesheet, asking for the result in hours, you may credit someone with one hour for two minutes work.
I would agree with dimava - calculate in minutes then convert it back.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|