5
I need to work with times, such as a chronometer (not my case), which at the end of its execution would have to keep its value.
So I thought of some possibilities like:
java.utils.Date
: only that the data in the case is not a Date;- In
long
: keeping the times in milliseconds, and converting it to the necessary formats whenever necessary; (if this is the way I found these two examples of conversions: this one right here at Sopt, and that) - Create my own object
Tempo
, that makes the control over milliseconds as in the previous option;
My doubt is the following (Follow my question algorithm):
String pergunta = "Há alguma forma/tipo no Java que seja adequada a esse tipo de informação"
+ ", que não seja uma forma adaptativa como no caso de armazenar em um long?";
boolean resposta = fazerPerguntaComRespotaBoolean(pergunta);
String perguntaSecundaria = null;
if(resposta == true){
perguntaSecundaria = "Qual seria? E como utilizar?";
} else {
perguntaSecundaria = "Qual forma adaptativa é mais 'adaptativa' e esse tipo de dados?";
}
String respotaSecundaria = fazerPerguntaComRespotaDissertativa(perguntaSecundaria);
System.out.println(respotaSecundaria);
Note: If anyone bothers, or if it became complicated to understand my question, I remove the algorithm format of my question, no problems, it is just to relax.
Is there a problem with https://docs.oracle.com/javase/8/docs/api/java/time/package-summary.html? Conjece o http://www.joda.org/joda-time/? You have read this https://docs.oracle.com/javase/tutorial/datetime/iso/datetime.html?
– Maniero
@bigown, did not know no, I already took a superficial look and it seems that will help, I will see how to work with times with these objects as quoted in the question, ex:
14h 23m 34s
. Thanks for the tip.– Fernando Leal