Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to get the day of the month from date field

Yancee
Level 1
Level 1

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();

}

1 Accepted Solution
_Bruce_Robertson
Correct answer by
Level 10
Level 10

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

View solution in original post

0 Replies
_Bruce_Robertson
Correct answer by
Level 10
Level 10

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

View solution in original post

Yancee
Level 1
Level 1

Thank you so much, that worked perfectly!