-1
I’d like to know how to get to the time of the field txt_hora
and move on to the txt_hora2
adding up +3 minutes. In case on the field one would be 09:50 and move on to the other 9:53.
Here I enter with the Hour
And after clicking "IR" falls on this screen
According to the image, I need to transfer the first hour to the other fields, but counting +3 minutes. I tried to do it this way, but I could not:
txt_hora2.setText("" + (Integer.parseInt(txt_hora.getText()) + 3));
and this too:
txt_hora2.setText("" + (Integer.parseInt(txt_hora.getText()) + (1000 * 60 * 3)));
What field are you talking about? There’s no code for them in the question.
– user28595
I guess I didn’t explain it right. The field I say, is a jtextfield where I take an hour of the site in an hour and minutes. but I would like to pass this time to another jtextfield, but adding +3 minutes
– Rafael Chaves
See this: https://stackoverflow.com/a/40952687/5524514
– user28595
This link has several methods, just choose one.
– user28595
I don’t quite understand. What I have difficulty understanding is that in one of the fields I have to bring the correct time, but in the second field I already have to bring it counting +3 minutes. pq in my case are tests that are carried out every 3 minutes, and as I am bringing 3 test at once, I need to add +3 in their header.
– Rafael Chaves
Rafael, add a [mcve] of your code, not everyone can see images and they, depending on the problem, do not help much.
– user28595
in this case I will not know how to create it, but thank you for the attention.
– Rafael Chaves
It gets complicated to reopen your question so with a [mcve] makes it easy to test the problem.
– user28595
I understand, but I appreciate your help anyway.
– Rafael Chaves
You don’t want your question to be reopened?
– user28595
I would like to, because I am standing still because of this doubt, but I will not be able to give an example in this condition.
– Rafael Chaves
Think about who wants to help you, with the closed question, you won’t get help, and without a [mcve], it’s even harder to suggest something that can solve your problem. I’d like to help you myself, but if you don’t show an effort to facilitate my collaboration in understanding your problem, how do you expect to get help? That’s why we ask for a simple testable example, in the link explains how to make a simplicate version of your code.
– user28595
the problem is that I don’t know how to develop an example that is executable, without the database, because this information is from there, and the example that I could do would only run in netbeans, which would not be applicable by you.
– Rafael Chaves
first you have convert to a date and after that use the Calendar and give an add() of 3 minutes, the question would ta open to post the solution. Take a look at this https://stackoverflow.com/questions/9015536/java-how-to-add-10-mins-in-my-time
– Edson Reis
I suggest you also search for Jspinner instead of converting string to date and time. Java has a component that already enables you to recover Timestamp values directly without conversions or parses, opting for text fields is to go around in something that the language simplifies for you.
– user28595