Sequential Date Expression

After Effects
April 4, 2025

// Set the initial date
initialDate = new Date('December 17, 2024 09:00:00');

// Calculate the number of weeks to add based on the layer's index
weeksToAdd = thisLayer.index - 1;

// Add the weeks to the initial date
newDate = new Date(initialDate.getTime() + weeksToAdd * 7 * 24 * 60 * 60 * 1000);

// Get day of the week
daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
dayOfWeek = daysOfWeek[newDate.getDay()];

// Get month name
monthsOfYear = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
month = monthsOfYear[newDate.getMonth()];

// Get day, year, and time
day = newDate.getDate();
year = newDate.getFullYear();

// Format the time
hours = newDate.getHours();
minutes = newDate.getMinutes();
amPm = hours >= 12 ? "PM" : "AM";
formattedHours = hours % 12 || 12; // Convert to 12-hour format
formattedMinutes = ("0" + minutes).slice(-2);

// Combine into the desired format
dayOfWeek + ", " + month + " " + day + ", " + year + " at " + formattedHours + ":" + formattedMinutes + " " + amPm;

Copy the expression below and paste into your text layer’s Source Text property.

How to use the script

Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.

Option 1: Install to your AE Folder

Download and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.

Option 2: Adapt the script yourself

Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.

Research, interviews, and tools for modern motion designers.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.