i need help on datediff function
hi guys. is it ok if i ask questions here pertaining to my project? i was told to do a program in VB about internet cafe billing program. its like, i have a server in my cafe and a customer wants to log in. so i enter PC #1 and the timer starts. after several minutes he decided to stop so i search for PC #1 and the number of hours and rate will be automatically show.
any help pls? my prof at school haven't teach use that topic yet :(
any links, codes, or explanation will be very well appreciated. thanks!
Re: i need help on datediff function
So your problem is the DateDiff-part.
Store the time when a user logs in and when he logs out, both as Date.
Code:
HouresUsed= DateDiff("h",LogInTime,LogOutTime)
I hope your Prof did teach the rest ;-)
Re: i need help on datediff function
so hoursused is lblhoursused.caption? so if i assign log in = now, will that time freeze or will it keep moving? damn im too newbie
Re: i need help on datediff function
Quote:
Originally Posted by
cherrydee
so hoursused is lblhoursused.caption? so if i assign log in = now, will that time freeze or will it keep moving? damn im too newbie
Based on opus's code:
LogInTime and LogOutTime are two variables that store the time of logging in and logging out respectively.
You have to store the time of both operations. Then only you will be able to use that line of code.... :wave:
When you store a value to a variable, that value will be available until it is cleared from the memory. (Tutorial: http://www.vbforums.com/showthread.php?t=468662)
Check this FAQ section to know more: http://www.vbforums.com/showthread.php?t=348141