time24(
TIME
)
The time24( function takes a time and makes sure it falls within a 24 hour period.
Parameters
This function has one parameter:
time – is a time (number of seconds) that may be greater than 23 hours, 59 minutes, 59 seconds, and may also be less than zero.
Description
The time24( function takes a time and makes sure it falls within a 24 hour period. If the time is less than 24 hours, it is unchanged. If the time is greater than 24 hours, it is converted to the equivalent time in a 24 hour period (for example 30:00:00 is converted to 6:00:00).
The time24( function can help with calculations of an ending time from a start time and duration. The basic formula for such a calculation is shown here.
EndTime=StartTime+Duration
This formula works fine unless the interval extends over midnight. The time24( function adjusts the result to make sure it starts over at zero as it crosses midnight.
EndTime=time24(StartTime+Duration)
This formula will correctly calculate that 10:30 PM + 4 hours is 2:30 AM.
See Also
- converttimezone( -- converts a time or superdate from one time zone to another.
- daylightsavingstimeoffset( -- returns the current daylight saving time offset of the specified time zone.
- info("localtimezone") -- returns the local time zone for the current location of your computer.
- info("milliseconds") -- returns the number of milliseconds (1/1000th second) since the system started up.
- info("tickcount") -- returns the number of ticks (1/60th second) since the system started up.
- info("timezoneabbreviations") -- returns a dictionary of time zone abbreviations supported by the system.
- info("timezones") -- returns a list of time zone regions recognized by the system.
- longtimestr( -- converts a number to text in am/pm time format, including seconds.
- nextdaylightsavingstimetransition( -- returns the next date on which a transition to or from daylight savings time occurs.
- now( -- returns the current time (number of seconds since midnight).
- regulartime( -- extracts a regular time (seconds since midnight) from a superdate.
- secsminshours( -- this converts a time (number of seconds) into an approximate text value.
- superdate( -- converts a regular date and a regular time into a superdate.
- superdatepattern( -- converts a number containing a superdate to text, allowing you to specify the patterns for both the date and the time conversion to text.
- superdatesecondsstr( -- converts a number containing a superdate to text, including the seconds.
- superdatestr( -- converts a number containing a superdate (date + time) to text.
- supernow( -- returns the number representing the current date and time as a superdate.
- texttimedifference( -- allows time math to be performed on text values.
- texttimeinterval( -- allows time math to be performed on text values.
- time( -- converts text into a number representing a time.
- timedifference( -- calculates the difference between two times. It works correctly even if the interval between the two times crosses over midnight.
- timeinterval( -- calculates the time interval between two times. It works correctly even if the interval between the two times crosses over midnight.
- timepattern( -- converts a number representing a time into text. The function uses a pattern to control how the time is formatted.
- timestr( -- converts a number to text in am/pm time format.
- timezoneabbreviation( -- returns the abbreviation of the specified time zone.
- timezonename( -- returns the continent and city of the specified time zone.
History
10.0 | No Change | Carried over from Panorama 6.0 |