Livecode Wiki
Advertisement

Returns the current time.

Built-in Function handler

Syntax:

time()
 the [{ long | abbr[ev[iated]] | short }] [{ english | system }] time

Examples:

set the lastModifiedTime of this card to the time 
set the label of button "Clock" to the short system time

Use the time function to display the current time to the user, or to store the time for later use.

If the twelveHourTime property is set to false, the value returned by the time function does not include "AM" or "PM".

Options:

  • none: 11:54 AM
  • long: 11:54:43 AM
  • abbr: 11:55 AM


The format of the system time forms is set by the Date & Time control panel (on Mac OS systems), the Date control panel (on Windows systems), or the LANG environment variable (on Unix systems).

Linux systems don't have a short system time, so the engine modifies the system time format string to remove the seconds. This works in most locales, but not all and our advice is to stick to using the long system time on Linux systems.


Changes: The ability to use the time format preferred by the user was introduced in version 1.1. In previous versions, the time function, along with the date function, consistently used the standard U.S. format, even if the operating system's settings specified another language or time format.

See also: ticks (function), format (function), useSystemDate (property),

Advertisement