timepattern(
timepattern(
TIME
,
PATTERN
)

The timepattern( function converts a number representing a time into text. The function uses a pattern to control how the time is formatted.

Parameters

This function has two parameters:

time – is the number that you want to convert to text. This number is treated as the number of seconds since midnight. (The seconds( and time( functions can convert text into such a number).

pattern – is text that contains a pattern for formatting the time.

Description

The timepattern( function converts a number representing a time into text. The function uses a pattern to control how the date is formatted. The pattern is assembled from four components: hh (hours), mm (minutes) ss (seconds), and am/pm. Some of the more common time patterns are listed here:

Pattern | Typical Output
--- | ---
`"hh:mm:ss am/pm"` | `4:32:17 pm`
`"hh:mm am/pm"` | `4:32 pm`
`"hh:mm:ss"` | `16:32:17`

If am/pm is left off the pattern, the time will be formatted in 24 hour format, as shown on the last line of the table above. You should also leave off am/pm for converting elapsed times to text.

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.
- time24( -- takes a time and makes sure it falls within a 24 hour period.
- 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.
- 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

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now displays a minus sign at the front if a negative elapsed time is displayed.