Skip to main content

In the attribute manager, I would like to create a new field called ('Age') and calculate the attribute value from another field called 'Date of Birth'. This is within an automated process that will be run multiple times a month, so I need it to take the time that the process is run and use that for the age calculation. How can I do this?

This is my attempt at this : (GETDATE() - @Value(Date of Birth)) / 365 (although there is no GETDATE function as far as i'm aware of.)

 

Thanks in advance!

@vladimirb777​ 

The FME function for the current date and time is @DateTimeNow() as mentioned here in the Date Time documentation. To calculate the age, you can use the DateTimeCalculator transformer. Set the Start Datetime parameter to the birthday attribute and the End Datetime as @DateTimeNow() function.

If the date in the 'Date of Birth' attribute is not already in the FME datetime or ISO format, you may need to convert it first to either FME format or ISO format with the DateTimeConverter in order for the DateTimeCalculator to work.

I hope this information helps.


@vladimirb777​ 

The FME function for the current date and time is @DateTimeNow() as mentioned here in the Date Time documentation. To calculate the age, you can use the DateTimeCalculator transformer. Set the Start Datetime parameter to the birthday attribute and the End Datetime as @DateTimeNow() function.

If the date in the 'Date of Birth' attribute is not already in the FME datetime or ISO format, you may need to convert it first to either FME format or ISO format with the DateTimeConverter in order for the DateTimeCalculator to work.

I hope this information helps.

That worked! Thank you :)


Reply