I am trying to get the current date for a user macro. I've tried using various utilities that documentation seems to indicate will be available, but to no avail. These include Java's, VTL's, and Confluence specific VTL context (https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity/).
For example, I'd expect to be able to do something like this:
#set ($dateString = $date.get('yyyy-MM-dd') )
@Jeremiah Dost can you give this a try:
#set ($dateString = $action.dateFormatter.formatGivenString("yyyy-MM-dd",$content.currentDate))
I ended up finding a solution later last night where I used a Calendar in conjunction with the .formatGivenString() method you have here.
#set ($today = $action.dateFormatter.formatGivenString("yyyy-MM-dd", $action.dateFormatter.getCalendar().getTime()) )
I don't see a currentDate field in the documentation for the ContentEntityObject (https://docs.atlassian.com/atlassian-confluence/6.6.0/index.html?com/atlassian/confluence/core/ContentEntityObject.html), but I'll give it a try.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.