Results 1 to 4 of 4

Thread: i need help on datediff function

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    20

    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!

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    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 ;-)
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2010
    Posts
    20

    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

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: i need help on datediff function

    Quote Originally Posted by cherrydee View Post
    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....

    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

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width