P
P
p_paralytic2020-10-18 14:35:56
Java
p_paralytic, 2020-10-18 14:35:56

How to work with time in Java?

I'm a newbie and this problem is confusing me.
By pressing the button, the chronometer starts working, showing how much time has passed since pressing (up to months and years). Initially, I just worked with a variable that increased every second, I realized that it was not an option, because when the application is closed or the phone is rebooted, the time counter is reset. Please help and advice on how to implement this idea

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Roo, 2020-10-18
@xez

Just store the button click date in a database or a file.
For java 8+ use: LocalDateTime
For earlier versions : Date

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question