1
I wanted to count registered clients in my bank, born in the year 1930 until the current year (2017).
In my bank I have registered as date
, date of birth ex: 2000-10-01
So I wanted to make one for
comparing the year 1930 with the date
from the bank and I don’t know how.
From what I’ve researched it would be something like this:
for (Date dt = dt1; dt.compareTo(dt2) <= 0;) {
//aqui fazer a logica de contagem...
}
Would you have any suggestions?
It is not easier to do this in the database query not? If the data field comes from there, there is no reason to demand this for the logic of the program.
– user28595
@diegofm do not know honestly. I am researching about this.
– Vilma
How do you retrieve this bank date? Is it a Date field? Which bank is using?
– user28595
@diegofm sim é Date... no banco está assim: 2000-01-01 (example). The database I am using is Postgresql.
– Vilma
You can try filtering directly in the database with a query like:
SELECT columns FROM table WHERE dateColumn >= '1930-01-01'
– user28595