Convert Java string to Time, NOT Date -
this question has answer here:
- parse clock time in java 8 1 answer
i convert variable string time type variable, not date using java. string 17:40
i tried using code below instance date type variable not time
string fajr_prayertime = prayertimes.get(0); dateformat formatter = new simpledateformat("hh:mm"); fajr_begins = (date)formatter.parse(fajr_prayertime); system.out.println(" fajr time " + fajr_begins);
however netbean complains should insert exception below;
dateformat formatter = new simpledateformat("hh:mm"); try { fajr_begins = (date)formatter.parse(fajr_prayertime); } catch (parseexception ex) { logger.getlogger(javafxapplication4.class.getname()).log(level.severe, null, ex); } system.out.println(" fajr time " + fajr_begins);
any idea how can time out of string above.
java.sql.time timevalue = new java.sql.time(formatter.parse(fajr_prayertime).gettime());
Comments
Post a Comment