top of page

Digital Clock Expression

Background Line UI

Dynamic, Clock, Time Based Animation

Digital Clock Expression

This After Effects expression creates a real-time digital clock by displaying the current time in a HH:MM:SS format.

For a composition starting at 0:00:00, after 5 minutes, the clock will display 00:05:00. After 1 hour, it will show 01:00:00. As the time continues, it will dynamically update, displaying 02:30:45 after 2 hours, 30 minutes, and 45 seconds. The clock will keep running and updating in real-time, formatted in HH:MM:SS, even if the composition is paused and played back later.

// Get the current time in hours, minutes, and seconds
var t = time;  
var hours = Math.floor(t / 3600) % 24;  // Hours (24-hour format)
var minutes = Math.floor(t / 60) % 60;  // Minutes
var seconds = Math.floor(t) % 60;       // Seconds

// Format the time as HH:MM:SS
var formattedTime = pad(hours) + ":" + pad(minutes) + ":" + pad(seconds);
formattedTime;

// Function to add leading zero if number is less than 10
function pad(num) {
    return (num < 10) ? "0" + num : num;
}

How to Use This Expression?

  • Add a Text Layer: Create a text layer in your composition.

  • Apply the Expression: Alt + Click (Windows) or Option + Click (Mac) the stopwatch icon for the Source Text property of the text layer.
    Paste the script into the expression editor.

  • Playback: Play the composition to see the live timer update as the playhead progresses.

Support Our Mission to Keep It Free

Your contribution ensures ongoing access to high-quality, easy-to-use After Effects expressions and libraries for

everyone.

Trending
Free After Effects Tutorials & Templates

As one of YouTube's leading creators of Motion Graphic Tutorials, we provide a diverse array of resources, including After Effects templates, royalty-free sound effects, and Photoshop PSD Templates. We also offer premium After Effects Templates and Sound Effects, designed to meet the needs of both beginners and professionals in the Motion Graphics field.

Copyright © 2025 Avnish Parker.

All Rights Reserved.

Follow Us

  • Youtube
  • Grey Facebook Icon
  • Twitter
  • Instagram
  • Patreon_logo_Small_edited_edited
Online Payment Icons
bottom of page