How to compare attribue having DateTime format with some particular date?

0
I have a attribute name dueDate in domainModel and I want to compare its value with some default date in condition for visibility based on expressions For example - $currentObj/dueDate = '2017-08-03'. I  need correct expression to define for visibilty.   Thanks in advance.
asked
2 answers
1

You have to parse your string to a DateTime type. Only then you can compare with another DateTime field, like dueDate is for you. 

The function you need is parseDateTime[UTC], so something like this could be used:

$currentObj/dueDate = parseDateTime('03-08-2017','dd-MM-yyyy', dateTime(2017))

 

parseDateTime[UTC]

Takes a string and tries to parse it. If it fails and a default value is specified, it returns the default value. Otherwise, an error is raised. The function parseDateTime uses the user’s timezone and parseDateTimeUTC uses the UTC calendar.

Input parameters

  • a date Type: String
  • a format Type: String
  • a default value (optional) Type: DateTime

Output

The parsed date, or the default value if a date could not be parsed. Type: DateTime

answered
0

I don't know if this function supports conditional visability, but you could try using:

$currentObj/dueDate = dateTime(2017, 8, 3)

or dateTimeUTC, depending if your attribute is localized or not.

See Date creation for more information

 

 

answered