Hi,
i would like to copy some page with the current date.
Example myPage.html -> myPage_2013-08-15_13:36.html
The following code copies the page but without date. It is because of such signs (-, :,....). How can you overcome this?
Date date = new Date(); SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd HH:mm" ); String testDate= df.format(date); pageManager.copy(pathOfMyPage), pathOfMyPage-"+testDate, "", true, false);
Solved! Go to Solution.
Hi there, for me this code worked just fine:
<% Date date = new Date(); SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd_HH-mm" ); String testDate= df.format(date); String path = currentPage.getPath(); pageManager.copy(currentPage,path+testDate,null, true, false,true); %>
I know that it's not exactly the same pattern as you used but I don't really see the point in having ":" in the file name.
Thats the only difference though..
Hope this helps
Johan
this page has some tips about escaping the illegal characters:
http://wiki.apache.org/jackrabbit/EncodingAndEscaping
scott
Views
Replies
Total Likes
Hi there, for me this code worked just fine:
<% Date date = new Date(); SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd_HH-mm" ); String testDate= df.format(date); String path = currentPage.getPath(); pageManager.copy(currentPage,path+testDate,null, true, false,true); %>
I know that it's not exactly the same pattern as you used but I don't really see the point in having ":" in the file name.
Thats the only difference though..
Hope this helps
Johan
Views
Likes
Replies
Views
Likes
Replies