Time

The Time Data Type is used to represent the time of the day. The time consists of an hour, minute, second, and millisecond, all of which begin at zero.

Structure

Time is an object with the following properties:

  • hour (number) - an hour of a day represented by a 24-hour clock
  • minute (number) - the number of minutes into the hour
  • second (number) - the number of seconds into the minute
  • millisecond (number) - the number of milliseconds into the second

Examples

Let's assume we have an example_time variable holding the following time:

time: {  
    "hour": 12,  
    "minute": 00,  
    "second": 00,  
    "millisecond": 000  
}

We can use the TIME function, which takes the hour, the minute, the second and, optionally, the millisecond, for example, to create a time representing exactly noon:

example_time = TIME(12, 00, 00, 000) -> {  
    "hour": 12,  
    "minute": 00,  
    "second": 00,  
    "millisecond": 000  
}

Also, we can use the FORMAT_TIME function to format the time into the string "12 pm":

FORMAT_TIME(  
  example_time,   
  "h:mm a"
) -> "12:00 PM"