TI-BASIC:Timecnv

From Learn @ Cemetech
Jump to navigationJump to search

TIMECNV.PNG

Command Summary

Converts seconds into the equivalent days, hours, minutes, and seconds.

Command Syntax

timeCnv(value)→variable

Menu Location

This command can only be found in the catalog. Press:

  1. 2nd CATALOG to enter the command catalog
  2. t to skip to commands starting with T
  3. Scroll down to timeCnv( and select it

Calculator Compatibility

TI-84+/SE

Token Size

2 bytes

The timeCnv( command converts seconds into the equivalent days, hours, minutes, and seconds. You just specify a number of seconds (should be a whole number, although a decimal number would work too; the calculator will simply use the integer part and discard the decimal) and the calculator will automatically break the seconds up into the standard parts of time, storing them in list format -- {days,hours,minutes,seconds}. You can Store this list to a variable for later use, or manipulate it the same way you do with other lists.

The number of seconds you specify can be as small or large as you want, although the number must be at least zero (in which case, the time list will be all zeroes). At the same time, you will run into the standard number precision problems that plague TI-Basic when specifying an extremely large or small number. Because of this, you should try to use numbers with less than 10 digits. Here is a simple example, where the time is exactly 1 day, 1 hour, 1 minute, and 1 second:

:timeCnv(90061→L1
:Disp Ans

The time conversion is 60 seconds for a minute, 3600 (60*60) seconds for an hour, and 86400 (60*60*60) seconds for a day. Adding these three together plus the one second gives you the value that you see in the example. This is pretty basic math, so it should be easy to understand.

Related Commands