944,068 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1087
  • C++ RSS
Mar 2nd, 2007
0

Easy question: Decimals to time

Expand Post »
I am using c++ and would like to know the easiest way to turn decimals in to the form hours:minutes:seconds.

You can assume the integer is in the form of hours (e.g. 242.4 = 242 hours 24 seconds etc)

Also, I would like it so that seconds is to one decimal place, and that if a field is blank it will show up like this 00:00:00.0

Thanks heaps :mrgreen:
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
japat is offline Offline
2 posts
since Mar 2007
Mar 2nd, 2007
0

Re: Easy question: Decimals to time

Ok i worked out the setfill(n) function, so i just need the other part
Reputation Points: 10
Solved Threads: 0
Newbie Poster
japat is offline Offline
2 posts
since Mar 2007
Mar 2nd, 2007
0

Re: Easy question: Decimals to time

modf() will help you split a floating point number into its integer and fractional parts. see man pages for more details8
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is online now Online
21,956 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: How to get path of current appl (in char) for Mac OS X
Next Thread in C++ Forum Timeline: Enter string to the next line





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC