Skip to main content
Participant
December 2, 2022
Question

Text Variables for Dates

  • December 2, 2022
  • 2 replies
  • 458 views

Is there a way to create a folio to automatically display the next day's date? I know how to create one to display the date using the modifaction date, but is it even possible in InDeign to have a folio be based on the intended publication date? I produce a newspaper the night before publication date and using a text variable to display the next day's date would be ideal. 

This topic has been closed for replies.

2 replies

Legend
December 3, 2022

Hello @tonyb13686604,

 

You can give this script a try for your needs...it creates a Custom Text type Text Variable named "Publication Date" that will disply tomorrows date.

 

EDIT: the code was modified on 12-03-22 @6:00pm EST

 

addDays(1);
function addDays(addDay){
    var today = new Date();
    today.setDate(today.getDate() + addDay); 
    var month = "0" + (today.getMonth()+1);
    var date = "0" + today.getDate();
    month = month.slice(-2);
    tomorrowsDate = date.slice(-2);
     var tomorrowsDate = month + "-" + date + "-" + today.getFullYear();

try{app.activeDocument.textVariables.add({name:"Publication Date", variableType:VariableTypes.CUSTOM_TEXT_TYPE,}); } catch (e){}
   if(app.activeDocument.textVariables.itemByName("Publication Date").isValid){
     app.activeDocument.textVariables.itemByName("Publication Date").variableOptions.contents = tomorrowsDate;
  }
}

 

Regards,

Mike

Scott Falkner
Community Expert
Community Expert
December 2, 2022

Only thing I can suggest is setting your system clock date one day ahead. You might be able to script that.