mercredi 4 juin 2014

Time zone conversion


Vote count:

0




I am trying return the Central Time by getting the instance of current time and converting to central time. I compiler throws an error when I use a return type while it prints the time. Here is my code:



Calendar cal = Calendar.getInstance();
Date d = cal.getTime();
cal.setTimeZone(TimeZone.getTimeZone("US/Central"));
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf2.format(d);


asked 18 secs ago






Aucun commentaire:

Enregistrer un commentaire