Hai

I want to set my time to system in our application, how to set the time and to get the time?

Recommended Answers

All 4 Replies

You can get the time via a call to

System.currentTimeMillis();

and parsing the returned long using the Calendar class. I'm not sure if it is possible to set the System time in Java but I'm not sure that you should either.

You can't set the system time in Java without making system-specific calls through a Process or with JNI.

is there any other way to solve this problem, because iam using counter in my project, during actions on button the counter stops until button process completes, please help me for this problem

You need to clarify that a little. Are you saying that UI updates are stopping until your button action completes? If that is the case, you need to use a separate thread to perform the button action. I don't see any connection at all to your original question about system time, so please be more specific on the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.