Convert Java string to Time, NOT Date -


this question has answer here:

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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -