Java: Converting 12 hour time to 24 hour time -
this question has answer here:
- java string date conversion 13 answers
is there simple function convert time that's this: 10:30pm 17 aug 2016 nzst 2016-8-17-2230
import java.text.simpledateformat; import java.util.date; public class main { public static void main(string [] args) throws exception { simpledateformat displayformat = new simpledateformat("yyyy-mm-dd-hhmm"); date date = new date();//current date system.out.println(displayformat.format(date)); } } see java documentation http://docs.oracle.com/javase/1.5.0/docs/api/java/text/simpledateformat.html
Comments
Post a Comment