MVEL + update + specific date : Update a date field to a specific date?

Hello,

I would like to know how to update a date field to a specific date as 12-12-2014 ?

I try to use MVEL fn.date() but failed…

thanks

0 votes

1 answers

8203 views

ANSWER



Hello Me,

I found this things:

  1. The java object for Date is java.util.Calendar
  2. The class that is used for Fn.calendar is org.nuxeo.ecm.automation.features.PlatformFunctions.calendar(java.util.Date) but it's not needed there

This is the code that I did :

java.util.Calendar cal= java.util.Calendar.getInstance(java.util.Locale.getDefault()) ;
//warning calendar month starts at 0 (=JANUARY), 1(=FEBRUARY)...
cal.set(2999, 11, 31);
WorkflowVariables["birthDate"]=cal;

Info about calendar:=> result is 2999-12-31

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
System.err.println(format.format(cal.getTime()));
0 votes