How to get a cur[rent date inside expression Form

Hello ,

so my question is how to get the system current date inside an expression of a form in modeler i tried ( ${flw.now()} but i didn’t have value how to make it work please also i need to know how to get the value of options from form1 inside another form2 value thank you very much.

Does `{{flw.now()}}’ work?

no it doesn’t work sorry

Supported only in enterprise edition.

1 Like

If i undertood i can’t get current date inside expression in open source version ?

Get current date in flowable opensource form is possible. (I do not know how.) EE supports flw.now.
In case of opensource I would focus on javascript methods.

Martin

It is only in the enterprise version, I got around this problem by creating my own service with various time utils for getting dates and doing conversions. Flowable uses Joda time so you might need to do some conversions for your own data model etc. I can’t remember the exact usage but something like below, I have used this strategy for getting times and dates from forms and setting them in other timer events.

@Service("flowableTimeUtils")
public class FlowableTimeUtils 
{    
    public LocalDateTime now()
    {
        return LocalDateTime.now();
    }
    
    public LocalDate today()
    {
        return LocalDate.now();
    }

    public String formatedDate(LocalDate date, String format)
    {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
        return date.format(formatter);
    }
    
    public String formatedDateTime(LocalDateTime dateTime, String format)
    {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
        return dateTime.format(formatter);
    }
}

Then you should be able to call in your model:

${flowableTimeUtils.now()}

Flowable doesn’t use Joda time. We do have support for storing Joda time types, but we are not using those types as return values anyways. We are mostly using java.util.Date in our types. We also do have support for storing your own Instant, LocalDate, LocalDateTime as well.

Cheers,
Filip

Apologies, yes checked my code. My issue with Joda time was related to the date field in a flowable Form which was passed to my function as org.joda.time.LocalDate, so I had to convert it. I can see that I have also used LocalDateTime too with my now() function… Thanks for the clarification.