Hi,
In order to migrate a website to XWiki, I wanted to insert old news in XWiki
and then change the date to match the true date of the news (and not having
all news of the same day). This will allow to use XWiki for archives, etc.
I don't want to change the date by using direct access to the database, but
use velocity commands.
Then, I tried :
#set($mydoc = $xwiki.getDocument("MyPage"))
#set($xdoc = $mydoc.getDocument())
#set($date = $xdoc.getDate())
Current date : $date
Updating date :
#set($milli = $xwiki.parseLong("1155311178410"))
#set($tmpDate = $xwiki.getDate($milli))
$xdoc.setDate($tmpDate)
$xdoc.setCreationDate($tmpDate)
But it doesn't work (the news is still displayed with the wrong date) as it
should modify only the in-memory document.
By displaying the $xdoc.isFromCache() value, it is true.
Then, I tried $xwiki.xWiki.saveDocument($xdoc,$context.context)
But it didn't work neither.
What could I use to modify the date of a news (without modifying directly
the database).
Regards,
Florent