Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


convert time to timecode in extendscript?

Community Beginner ,
Jul 02, 2021 Jul 02, 2021

Copy link to clipboard

Copied

how convert time to timecode in extendscript?

for example:

1.5 sec convert to 01:15 in composition 30 framerate

TOPICS
How to, Scripting

Views

44

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 02, 2021 Jul 02, 2021

Copy link to clipboard

Copied

LATEST

You can find 'timeToCurrentFormat' here:

https://ae-scripting.docsforadobe.dev/general/globals/

 

You would need to make sure the project is set to display timecode not frames (Project.timeDisplayType), like here:

https://ae-scripting.docsforadobe.dev/general/project/#project-timedisplaytype

 

Make sure you read up on the docs about whether it calculates it as a duration or based on the project start frame.

 

This example will convert display type to timecode if necessary, make the conversion, then convert display type back if necessary.

 

var displayFrames = false;
if (app.project.timeDisplayType!= TimeDisplayType.TIMECODE) {
	app.project.timeDisplayType = TimeDisplayType.TIMECODE;
	displayFrames = true;
}
var theTime = 1.5;
var theFPS = 30; // obviously you could grab this from an active comp instead, assuming one was active

var theTimecode = timeToCurrentFormat(theTime, theFPS, true);

alert(theTimecode);

if (displayFrames) app.project.timeDisplayType = TimeDisplayType.FRAMES;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines