FORMATTIME function

FORMATTIME(time, timeFormat?, use24HourClock?) FORMATTIME(time; timeFormat?; use24HourClock?)

time — Number or { Number }

The time to format.

timeFormat — TimeFormat or { TimeFormat } (optional)

The time format to use when formatting the time. Use TimeFormat.HourMinuteTimeFormat,HourMinute for a text string that does not include seconds and TimeFormat.HourMinuteSecondTimeFormat,HourMinuteSecond for a text string that does include seconds. If omitted, TimeFormat.HourMinuteTimeFormat,HourMinute is assumed.

use24HourClock — Logical or { Logical } (optional)

Whether a 24-hour clock should be used, regardless of the time formatting conventions of the language the app has been configured to use. If omitted, FALSE is assumed.

Returns — Text or { Text }

A time formatted as text.

Returns a time as text. FORMATTIME(TIME(15, 30, 0))FORMATTIME(TIME(15; 30; 0)) returns "3:30 PM" if the language of the app is set to US English. (FORMATTIME takes the language of the app into account when converting dates.)

Use FORMATDATE together with FORMATTIME to format both a date and a time. This formula returns the current date and time, joined together with a comma and a space:

FORMATDATE(NOW()) & ", " & FORMATTIME(NOW())FORMATDATE(NOW()) & ", " & FORMATTIME(NOW())

This function is specific to Calcapp.

Time format

The second parameter must be set to the desired time format. These are the allowed values:

Time format US English example
TimeFormat.HourMinute 3:30 PM
TimeFormat.HourMinuteSecond 3:30:00 PM

Related functions and properties

Examples

FORMATTIME(TIME(15, 30, 0))FORMATTIME(TIME(15; 30; 0))

Returns "3:30 PM" if the language of the app is set to US English. TimeFormat.HourMinuteTimeFormat,HourMinute is assumed if no second parameter is given.

FORMATTIME(TIME(15, 30, 0), TimeFormat.HourMinute)FORMATTIME(TIME(15; 30; 0); TimeFormat,HourMinute)

Returns "3:30 PM" if the language of the app is set to US English.

FORMATTIME(TIME(15, 30, 0), TimeFormat.HourMinute)FORMATTIME(TIME(15; 30; 0); TimeFormat,HourMinute)

Returns "15:30" if the language of the app is set to German.

FORMATDATE(NOW()) & ", " & FORMATTIME(NOW())FORMATDATE(NOW()) & ", " & FORMATTIME(NOW())

Returns today's date, followed by a comma, a space and the current time.

FORMATTIME(TIME(15, 30, 0), TimeFormat.HourMinute, TRUE)FORMATTIME(TIME(15; 30; 0); TimeFormat,HourMinute; TRUE)

Returns "15:30" if the language of the app is set to US English. The third parameter instructs FORMATTIME to use a 24-hour clock.

FORMATTIME(TIME(15, 30, 0), TimeFormat.HourMinuteSecond)FORMATTIME(TIME(15; 30; 0); TimeFormat,HourMinuteSecond)

Returns "3:30:00 PM" if the language of the app is set to US English.