Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Calculate age
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
-
- nuBuilder Team
- Posts: 508
- Joined: Fri Dec 28, 2018 1:41 pm
- Location: Krakow, Poland
- Has thanked: 11 times
- Been thanked: 18 times
-
- nuBuilder Team
- Posts: 508
- Joined: Fri Dec 28, 2018 1:41 pm
- Location: Krakow, Poland
- Has thanked: 11 times
- Been thanked: 18 times
Re: Calculate age
or with mysql
https://stackoverflow.com/questions/577 ... sql-innodb
you can use on edit form Display field for example:
and for initial trial you can place directly in the Display -> Display/SQL field following code from above link:
(here you can refer to any table values from your DB)
you can place the following in the browse table display inside brackets():
https://stackoverflow.com/questions/577 ... sql-innodb
you can use on edit form Display field for example:
and for initial trial you can place directly in the Display -> Display/SQL field following code from above link:
Code: Select all
SELECT TIMESTAMPDIFF(YEAR, '1970-02-01', CURDATE()) AS age
you can place the following in the browse table display inside brackets():
Code: Select all
(SELECT TIMESTAMPDIFF(YEAR, '1970-02-01', CURDATE()) AS age)
or with reference to your data ex:
(SELECT TIMESTAMPDIFF(YEAR, cut_birth, CURDATE()) AS age)
If you like nuBuilder, please leave a review on SourceForge
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
-
- nuBuilder Team
- Posts: 4562
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 528 times
- Contact:
Re: Calculate age
Pros and cons (Display Object vs JavaScript)
Display Object:
[-] Is only refreshed after the form is saved
[+] It's easy to use
Using JavaScript:
[+] Age can be calculated at any time, even before the form is saved.
[-] Need JavaScript knowledge, maybe a date conversion nevessary.
Display Object:
[-] Is only refreshed after the form is saved
[+] It's easy to use
Using JavaScript:
[+] Age can be calculated at any time, even before the form is saved.
[-] Need JavaScript knowledge, maybe a date conversion nevessary.