2 digit Date conversion

Hello-

I am having an issue with 2 digit date conversion with respect to the Year. It looks like the default conversion is 20 plus, 80 years minus the current date and then use the relative current century. This does not work with the Birthdate format in question as we are working with an elderly population. Is there a way to either change these values or is there a suggested method to reformat these cases in the conversion? Thanks for any help.

jason

Hi,

As I understood, you would like to transform dates with two digit years to dates with four digits year format. This can be performed by the component Reformat. Below is an example of the transformation from the Reformat component that transforms dates from YY-MM-dd to YYYY-MM-dd format.

The transformation function compares two digit years with the predefined variable “a” that sets the boundary between years that belong to the current and to the last century. In the case below is the number a = 5, which means that years 00 - 05 will be prefixed with 20 and anything above will get prefix 19.

You can replace the “a” variable with a graph parameter to facilitate year adjustments.
function


integer a;
a = 05;

function integer transform() {

	if(str2integer(substring($in.0.Field1,0,2)) =< a){
	$out.0.Field1= "20"+substring($in.0.Field1,0,2)+chop($in.0.Field1, "^..");
	return 0;
	}
	else {
	$out.0.Field1="19"+substring($in.0.Field1,0,2)+chop($in.0.Field1, "^..");
	return 0;
	}
}

}

I hope this will help you!