How to create folder name with tomorrow(next date)?

This should do what you want:

The script, for reference:

function OnClick(clickData)
{
	var d = new Date(); // Today
	d.setDate(d.getDate() + 1); // Move date part to tomorrow.

	var dd = d.getDate();
	var mm = d.getMonth() + 1; // Jan=0,Feb=1,etc.
	var yyyy = d.getFullYear();
	var day = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][ d.getDay() ];

	if (dd < 10) dd = "0" + dd; // Pad to 2 digits
	if (mm < 10) mm = "0" + mm; // Pad to 2 digits

	var ds = yyyy + "-" + mm + "-" + dd + " " + day;

	clickData.func.command.RunCommand("CreateFolder READAUTO=no NAME=\"" + ds + "\"");
}

Edit: Here's a nicer way of doing the same thing:

function OnClick(clickData)
{
	var d = DOpus.Create.Date();
	d.Add(1,"d");
	var ds = d.Format("D#YYYY-MM-dd ddd");

	clickData.func.command.RunCommand("CreateFolder READAUTO=no NAME=\"" + ds + "\"");
}
2 Likes