How do I make a time calculator?

edited October 2013 in How To...

Is there a way to make a time calculator in processing? I'd like to be able to +,- hours, minutes and seconds. Any help is appreciated! Thanks

Answers

  • Please describe your situation more clearly.

    Processing provides several functions for accessing the current time, such asminute(). These functions should be sufficient for identifying the current time...

    If you want additional date / time manipulation functionality, then I recommend the Java library Joda-Time. It is far better organized than Java'sDateimplementation. Keep in mind that this includes lots of additional functionality and so may not be appropriate for all situations...

  • Thanks for your reply! For example... if you entered 1h + 30m + 30s it would say in a box 1h30m30s Thanks! I hope I've helped

  • Answer ✓

    Your example is too trivial, I suppose you want to add 1 h + 121 min + 222 s for example...

    Simplest way would be to convert all values to seconds, add them, then decompose back to minutes, hours and days. The % operator is useful for the last step.

Sign In or Register to comment.