Forums Register Login

Java.util.Calendar

+Pie Number of slices to send: Send



I have tried to get the current time object, So i wanna to execute every minute to be noticed and then it should terminate the program for one minute.

Like "Page will be expired in 60 Seconds".. 59 58..... upto 0...
Then my code should terminate, How can i achieve this?...
+Pie Number of slices to send: Send
 

hariharan jayaprakash wrote:I have tried to get the current time object, So i wanna to execute every minute to be noticed and then it should terminate the program for one minute.

Like "Page will be expired in 60 Seconds".. 59 58..... upto 0...
Then my code should terminate, How can i achieve this?...


Quite tricky to do with 100% certainty, but you should probably start by looking at Thread.sleep(). The java.util.Timer class may also be of use.

Winston
+Pie Number of slices to send: Send
I'd go for java.util.Timer or a ScheduledExecutorService (creating using the Executors utility class).

Also:

hariharan jayaprakash wrote:


You should compare against the constants:
They weren't very bright, but they were very, very big. Ad contrast:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1841 times.
Similar Threads
Problem in updating Time
How to compare (Hour) with actual new Date() ?
Calendar.HOUR for another timezone
What fields does java.util.Date.equals compare?
to compare time including AM and PM
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:34:08.