CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2019
    Posts
    8

    function for to calculate night shift and hours currents

    Hi, I need a function that calculates the daytime and nighttime hours within a shift, for example 16 hour of entry to 01 hour of departure of de next day, from 16 to 22 = 6 hours (daytime), and from 22 to 01 of the next morning = 3 hours (nighttime), total hours = 9 hours

    thanks for all

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: function for to calculate night shift and hours currents

    Did you try to use Date data type variables?
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2019
    Posts
    8

    Re: function for to calculate night shift and hours currents

    Quote Originally Posted by VictorN View Post
    Did you try to use Date data type variables?

    yes, but I do not know much about programming, I do not know how to do it

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: function for to calculate night shift and hours currents

    Quote Originally Posted by juanfrasantos View Post
    yes, but I do not know much about programming, I do not know how to do it
    Then learn the programming!
    And search for the reliable sample code!
    Victor Nijegorodov

  5. #5
    Join Date
    Apr 2019
    Posts
    8

    Re: function for to calculate night shift and hours currents

    i search but not find sample code about this, please help me, thanks

  6. #6
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: function for to calculate night shift and hours currents

    Have a look at the DateAdd() and DateDiff() functions
    Always use [code][/code] tags when posting code.

Tags for this Thread

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

Featured