Skip to content

time-conversion

Time Conversion

These methods are all about converting between various time formats.

Example

You can easily format and animate the timecode text by creating a text layer, applying whatever text styling you’d like, and adding this expression to the Source Text property:

timeToCurrentFormat();

Methods

framesToTime()

framesToTime(frames[, fps=1.0 / thisComp.frameDuration])

Description

Returns the time corresponding to the frames argument. It doesn’t have to be an integer.

The inverse of timeToFrames().

Parameters

ParameterTypeDescription
framesNumberThe amount of frames to convert.
fpsNumberOptional. The number of frames per second to use to convert. Defaults to 1.0 / thisComp.frameDuration (the frame rate of the current composition).

Returns

Number


timeToCurrentFormat()

timeToCurrentFormat([t=time + thisComp.displayStartTime][, fps=1.0 / thisComp.frameDuration][, isDuration=false][, ntscDropFrame=thisComp.ntscDropFrame])

Description

Converts the value of t to a String representing time in the current Project Settings display format.

Parameters

ParameterTypeDescription
tNumberOptional. The time (in seconds) to convert. Defaults to time + thisComp.displayStartTime.
fpsNumberOptional. Defaults to 1.0 / thisComp.frameDuration (the frame rate of the current composition).
isDurationBooleanOptional. Whether t represents a difference between two times, vs an absolute time. Absolute times are rounded down toward negative infinity; durations are rounded away from zero (up for positive values). Defaults to false.
ntscDropFrameBooleanOptional. If false, the result is NTSC non-drop-frame timecode. If true, the result is NTSC drop-frame timecode. Defaults to thisComp.ntscDropFrame.

Returns

String


timeToFeetAndFrames()

timeToFeetAndFrames([t=time + thisComp.displayStartTime][, fps=1.0 / thisComp.frameDuration][, framesPerFoot=16][, isDuration=false])

Description

Converts the value of t to a String representing feet of film and frames.

Parameters

ParameterTypeDescription
tNumberOptional. The time (in seconds) to convert. Defaults to time + thisComp.displayStartTime.
framesPerFootNumberOptional. Specifies the number of frames in one foot of film. Defaults to 16 (the most common rate for 35mm footage).
isDurationBooleanOptional. Whether t represents a difference between two times, vs an absolute time. Absolute times are rounded down toward negative infinity; durations are rounded away from zero (up for positive values). Defaults to false.

Returns

String


timeToFrames()

timeToFrames([t=time + thisComp.displayStartTime][, fps=1.0 / thisComp.frameDuration][, isDuration=false])

Description

Converts the value of t (some amount of time, in seconds) to an integer number of frames.

Parameters

ParameterTypeDescription
tNumberOptional. The time (in seconds) to convert. Defaults to time + thisComp.displayStartTime.
fpsNumberOptional. The number of frames per second to use to convert. Defaults to 1.0 / thisComp.frameDuration (the frame rate of the current composition).
isDurationBooleanOptional. Whether t represents a difference between two times, vs an absolute time. Absolute times are rounded down toward negative infinity; durations are rounded away from zero (up for positive values). Defaults to false.

Returns

Number


timeToNTSCTimecode()

timeToNTSCTimecode([t=time + thisComp.displayStartTime][, ntscDropFrame=false][, isDuration=false])

Description

Converts t to a String representing NTSC timecode.

Parameters

ParameterTypeDescription
tNumberOptional. The time (in seconds) to convert. Defaults to time + thisComp.displayStartTime.
ntscDropFrameBooleanOptional. If false, the result is NTSC non-drop-frame timecode. If true, the result is NTSC drop-frame timecode. Defaults to false.
isDurationBooleanOptional. Whether t represents a difference between two times, vs an absolute time. Absolute times are rounded down toward negative infinity; durations are rounded away from zero (up for positive values). Defaults to false.

Returns

String


timeToTimecode()

timeToTimecode([t=time + thisComp.displayStartTime][, timecodeBase=30][, isDuration=false])

Description

Converts the value of t to a String representing timecode.

Parameters

ParameterTypeDescription
tNumberOptional. The time (in seconds) to convert. Defaults to time + thisComp.displayStartTime.
timecodeBaseNumberOptional. Specifies the number of frames in one second. Defaults to 30.
isDurationBooleanOptional. Whether t represents a difference between two times, vs an absolute time. Absolute times are rounded down toward negative infinity; durations are rounded away from zero (up for positive values). Defaults to false.

Returns

String