How to calculate age based on date of birth? I want my form when user fill DOB, automatically populate the age field,...
Can someone show me?, i am using appgini 5.31. tq
How to calculate ages based on DOB?
Re: How to calculate ages based on DOB?

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: How to calculate ages based on DOB?
i ve tried, it's not work for me. Here is the code on hook. My table name is 'failj' , DOB=tlahir and Age=Umur, Please help me how to do it, tq...
<?php
// For help on using hooks, please refer to http://bigprof.com/appgini/help/working ... tion/hooks
function failj_init(&$options, $memberInfo, &$args){
return TRUE;
}
function failj_header($contentType, $memberInfo, &$args){
$header='';
switch($contentType){
case 'tableview':
$header='';
break;
case 'detailview':
$header='';
break;
case 'tableview+detailview':
$header='';
break;
case 'print-tableview':
$header='';
break;
case 'print-detailview':
$header='';
break;
case 'filters':
$header='';
break;
}
updateAge("MONTH(tlahir)=" . date('n'));
return $header;
}
function failj_footer($contentType, $memberInfo, &$args){
$footer='';
switch($contentType){
case 'tableview':
$footer='';
break;
case 'detailview':
$footer='';
break;
case 'tableview+detailview':
$footer='';
break;
case 'print-tableview':
$footer='';
break;
case 'print-detailview':
$footer='';
break;
case 'filters':
$footer='';
break;
}
return $footer;
}
function failj_before_insert(&$data, $memberInfo, &$args){
return TRUE;
}
function failj_after_insert($data, $memberInfo, &$args){
updateAge("ID='{$data['selectedID']}'");
return TRUE;
}
function failj_before_update(&$data, $memberInfo, &$args){
return TRUE;
}
function failj_after_update($data, $memberInfo, &$args){
updateAge("ID='{$data['selectedID']}'");
return TRUE;
}
function failj_before_delete($selectedID, &$skipChecks, $memberInfo, &$args){
return TRUE;
}
function failj_after_delete($selectedID, $memberInfo, &$args){
}
function failj_dv($selectedID, $memberInfo, &$html, &$args){
}
function failj_csv($query, $memberInfo, &$args){
return $query;
}
function failj_batch_actions(&$args){
return array();
}
function updateAge($where = ''){
$sql = "update `failj` set `Umur` = round(datediff('".date('Y-m-d')."', `tlahir`) / 365.25)";
if($where) $sql .= "where $where";
sql($sql, $eo);
}
?>
<?php
// For help on using hooks, please refer to http://bigprof.com/appgini/help/working ... tion/hooks
function failj_init(&$options, $memberInfo, &$args){
return TRUE;
}
function failj_header($contentType, $memberInfo, &$args){
$header='';
switch($contentType){
case 'tableview':
$header='';
break;
case 'detailview':
$header='';
break;
case 'tableview+detailview':
$header='';
break;
case 'print-tableview':
$header='';
break;
case 'print-detailview':
$header='';
break;
case 'filters':
$header='';
break;
}
updateAge("MONTH(tlahir)=" . date('n'));
return $header;
}
function failj_footer($contentType, $memberInfo, &$args){
$footer='';
switch($contentType){
case 'tableview':
$footer='';
break;
case 'detailview':
$footer='';
break;
case 'tableview+detailview':
$footer='';
break;
case 'print-tableview':
$footer='';
break;
case 'print-detailview':
$footer='';
break;
case 'filters':
$footer='';
break;
}
return $footer;
}
function failj_before_insert(&$data, $memberInfo, &$args){
return TRUE;
}
function failj_after_insert($data, $memberInfo, &$args){
updateAge("ID='{$data['selectedID']}'");
return TRUE;
}
function failj_before_update(&$data, $memberInfo, &$args){
return TRUE;
}
function failj_after_update($data, $memberInfo, &$args){
updateAge("ID='{$data['selectedID']}'");
return TRUE;
}
function failj_before_delete($selectedID, &$skipChecks, $memberInfo, &$args){
return TRUE;
}
function failj_after_delete($selectedID, $memberInfo, &$args){
}
function failj_dv($selectedID, $memberInfo, &$html, &$args){
}
function failj_csv($query, $memberInfo, &$args){
return $query;
}
function failj_batch_actions(&$args){
return array();
}
function updateAge($where = ''){
$sql = "update `failj` set `Umur` = round(datediff('".date('Y-m-d')."', `tlahir`) / 365.25)";
if($where) $sql .= "where $where";
sql($sql, $eo);
}
?>
Re: How to calculate ages based on DOB?
here is my form looks like
https://www.facebook.com/photo.php?fbid ... =3&theater
when i change the year, i want it automatically calculate age on 'Umur' Field by its self.tq
https://www.facebook.com/photo.php?fbid ... =3&theater
when i change the year, i want it automatically calculate age on 'Umur' Field by its self.tq