// enable double clicking from the Macintosh Finder // or the Windows Explorer #target photoshop // A function to get time that the operation was run. Print this to a .log file or into a files metadata function timeStamp(){ // Get the date and format it var date = new Date(); var d = date.getDate(); var day = (d < 10) ? '0' + d : d; var m = date.getMonth() + 1; var month = (m < 10) ? '0' + m : m; var yy = date.getYear(); var year = (yy < 1000) ? yy + 1900 : yy; // Get the time and format it var digital = new Date(); var hours = digital.getHours(); var minutes = digital.getMinutes(); var seconds = digital.getSeconds(); var amOrPm = "AM"; if (hours > 11) amOrPm = "PM"; if (hours > 12) hours = hours - 12; if (hours == 0) hours = 12; if (minutes <= 9) minutes = "0" + minutes; if (seconds <= 9) seconds = "0" + seconds; // create a global variable with the fully formatted the time and date todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " - " + day + "/" + month + "/" + year; } // run the function timeStamp(); // show the value of todaysDate alert(todaysDate);