Use modulus operator to convert time
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: Use modulus operator to convert time

  1. #1
    Join Date
    Jan 2010

    Use modulus operator to convert time

    I need to convert hours into weeks, days, and hours.

    My professor was hinting that there might be a way to
    do this using the modulus operator but I can't seem to think of a way
    that its possible. Can anyone help?


  2. #2
    Join Date
    Jan 2008
    California, USA

    Re: Use modulus operator to convert time

    Hi jhus00

    modulus operator returns the remainder of the division. you already know this correct?

    the first step is to define end goal of your program.
    you can show us, either in real or psuedo code, or written statement, how you would define this end goal.

    and don't forget to wrap your code inside [code] your code goes here[/code]
    Last edited by potatoCode; January 20th, 2010 at 09:56 PM.

  3. #3
    Join Date
    Jan 2009

    Re: Use modulus operator to convert time

    Well, the time_t structures is seconds since Jan 1st, 1970 at midnight GMT. There are 60 seconds in a minute, so time % 60 will give you the current seconds. From there you should be able to figure it out.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a survey!

HTML5 Development Center