Hello,
First of all thanks for your time reading our question, and thanks for your replies and help
We would need to know if a patient has less than 65 years old, using their birthday from the PID 7.1
So far we have developed the following code:
//
set nacimiento = request.GetValueAt("PID:DateTimeofBirth.Time")
$$$LOGINFO("nacimiento: "_nacimiento)
//22/04/1976
set nacimientoFormateado = ##class(Util.FuncionesComunes).DateFormatConvertToXML(nacimiento)
// ""
set nacimientoFormateado65 = $extract($system.SQL.DATEADD("yy",65,nacimientoFormateado),1,10)
// 2021-06-21
set hoy = $zdate($h,3)
$$$LOGINFO(nacimientoFormateado_" - "_nacimientoFormateado65_" - "_hoy)
if (hoy<nacimientoFormateado65){
$$$LOGINFO("hoy: "_hoy)
$$$LOGINFO("nacimientoFormateado65: "_nacimientoFormateado65)
set edad = "1"
}