Double Digit Dilemma
January 7, 2009 12:00 AM
Thanks for the suggestions.Since I was trying to create a digital clock displaying a fictional time different than the actual time, I finally was able to make this work by manipulating the colon between hour and minutes. I have a chain of actions that keep adding onto a variable with a string value: _currentTime. 1. I set _currentTime == _currentHour2. Add “:” to _currentTime if _currentMinute >= 103. Add “:0” to _currentTime if _currentMinute < 10 and > 04. Add “:00” to _currentTime if _currentMinute <= 05. Add _currentMinute to _currentTimeThis works the same way as Ben’s suggestion because the colon before the zero changes the variable value from a number to a string. That allows the _current Minute to be added on to the end instead of calculating “0 + 0” and adding nothing in return. I had to add “:00” because when viewed in HTML, _currentMinute was (I'm guessing) still doing math when == 0.
Discussions have been disabled for this post