How to get the day of the month from date field

Yancee 14-12-2016

Hello - I have a date/time field (DateEffective) that the user will fill out, and I need to determine if the day of the month is before the 15th or from the 15th on. For now, I created another calculated field (Cutoff) to try to get the date value using the getDate method, but it doesn't seem to work. What am I doing wrong?

if (DateEffective.rawValue == null || DateEffective.rawValue.length == 0)
{
Cutoff.rawValue = "waiting";
}
else {

Cutoff.rawValue = DateEffective.getDate();

}

Accepted Solutions (1)

Accepted Solutions (1)

BR001
MVP
14-12-2016

Hi,

The DateEffective is an XFA Object, so doesn't have a getDate() method, and the rawValue of a DateField returns a string, so you will need to turn that into a date object before calling getDate() on it.

Try;

util.scand('yyyy-mm-dd',DateEffective.rawValue).getDate()

Regards

Bruce