Get Year from event when contains BEF, AFT etc
Posted: 27 Jun 2022 16:46
Hi
I'm trying to get a person's year of birth.
My first attempt works as long as the date just contains a number, but fails (understandably) if it contains Bef or Aft etc.
pi - pointer to an INDI record
What I want get is Year part of their BIRT date
This works fine as long as YEAR is just a number
iYear = tonumber(fhGetItemText(pi,'~.BIRT.DATE:YEAR'))
However it fails if YEAR contains Before, After etc.
Was going to try
iYear = fhCallBuiltInFunction(%INDI.BIRT[1].DATE:YEAR%)
but couldn't work out how to pass the pointer pi to represent the INDI
Suggestions gratefully received
I'm trying to get a person's year of birth.
My first attempt works as long as the date just contains a number, but fails (understandably) if it contains Bef or Aft etc.
pi - pointer to an INDI record
What I want get is Year part of their BIRT date
This works fine as long as YEAR is just a number
iYear = tonumber(fhGetItemText(pi,'~.BIRT.DATE:YEAR'))
However it fails if YEAR contains Before, After etc.
Was going to try
iYear = fhCallBuiltInFunction(%INDI.BIRT[1].DATE:YEAR%)
but couldn't work out how to pass the pointer pi to represent the INDI
Suggestions gratefully received