This question already has an answer here:
DateFormat dateFormatOne = new SimpleDateFormat("HH:mm:ss");
dateFormatOne.setTimeZone(TimeZone.getTimeZone("UTC"));
Date dateOne = dateFormatOne.parse("10:00:00");
public static void main(String[] args) throws ParseException {
DateFormat dateFormatOne = new SimpleDateFormat("HH:mm:ss");
dateFormatOne.setTimeZone(TimeZone.getTimeZone("UTC"));
Date dateOne = dateFormatOne.parse("10:00:00");
System.out.println(dateFormatOne.format(dateOne));
System.out.println(dateFormatOne.format(new Date()));
}
Output
10:00:00
20:20:55
But I recommend Java 8
System.out.print(LocalTime.of(10, 0, 0));
If you want to display the current local time on the machine running the program you can use LocalTime.
import java.time.LocalTime; // import the LocalTime class
public class Main {
public static void main(String[] args) {
LocalTime myTime = LocalTime.now();
System.out.println(myTime);
}
}
How to prevent a token created with OAuth 2.0 from expiring?
When sending ics attachments created by ical4j via sendgrid to an outlook user they aren't able to "preview" the inviteIt recognizes that the attachment exists but claim "This file cannot be previewed because there is no previewer installed for it"
Greetings i'm trying to return Array to Python from java(jar file) but only return array type string:
Good Morning! I'm catching a lot in a settingCould you help me?
I am developing an xText project and in my Generatorxtend I produce a python script