I'm new to java and have been given the following piece of code to try and fix.
The code is renaming an existing HTML file with the current date but the problem is the date is out by one. I'm aware that in java Jan=0 Feb=1 etc but just dont know enough to know how to fix this...
If I add +1 to getmonth all that happens is the file gets named LEICESTER_DAILY - 24-71-2011 17.20.36 rather than LEICESTER_DAILY - 24-8-2011 17.20.36
Here's the piece of code
The code is renaming an existing HTML file with the current date but the problem is the date is out by one. I'm aware that in java Jan=0 Feb=1 etc but just dont know enough to know how to fix this...
If I add +1 to getmonth all that happens is the file gets named LEICESTER_DAILY - 24-71-2011 17.20.36 rather than LEICESTER_DAILY - 24-8-2011 17.20.36
Here's the piece of code
Code:
function makePerm() { var txtFile; // Swap the temporary file with the original if (fileSys.FileExists(grabParentFolderUrl() + 'tempsave.htm')) { txtFile = fileSys.getFile(grabParentFolderUrl() + 'tempsave.htm'); if (!(txtFile.size == 0)) { // Check file is not empty if (fileSys.FileExists(grabParentFolderUrl() + 'LEICESTER_DAILY.htm')) { var today = new Date(); var timeStamp = today.getDate() + '-' + today.getMonth() + '-' + today.getFullYear() + ' ' + today.getHours() + '.' + today.getMinutes() + '.' + today.getSeconds(); txtFile = fileSys.getFile(grabParentFolderUrl() + 'LEICESTER_DAILY.htm'); txtFile.Move(grabParentFolderUrl() + 'LEICESTER_DAILY - ' + timeStamp.toString() + '.htm'); txtFile = fileSys.getFile(grabParentFolderUrl() + 'tempsave.htm'); txtFile.Move(grabParentFolderUrl() + 'LEICESTER_DAILY.htm');
Comment