getAge() with wrong return |
Hello!
I have to check the age in my app and I use getAge() and get a wrong age. I'm in Germany, so I use German dates here: PHP Code: $bt2 = Time::parse($this->request->getVar('geburtstag')); The dates in "geburtstag" are 05.02.2008 and 03.02.2008. Today is the 04.02.2008. But both datas returns the same age 14. What do I not see here?
> Perfect for checking the age of someone based on their birthday:
https://codeigniter4.github.io/userguide...tml#getage How do you calculate the age of someone? (02-04-2022, 04:38 PM)kenjis Wrote: See https://github.com/codeigniter4/CodeIgni...#L461-L468 And that's maybe wrong, because it's not the age, it's just the year. (02-05-2022, 02:54 AM)InsiteFX Wrote: @kenjis, For me it is a little bit wired, if I have to work with time and date. So much different ways, some provided by PHP, some by CI. Now I upgrade an other helper, which I use to calculate date-time-diffs and it works correctly. It's actually very easy ;-) Do now wonder, it was designed to use this as my favorite diff-helper and it should to more as this helper do right now. PHP Code: function dateTimeDiff($older, $newer, $return = 'SEC') |
Welcome Guest, Not a member yet? Register Sign In |