Thursday 2 February 2012

Getting time date based on time zone in android


Calendar calendar = Calendar.getInstance();
   SimpleDateFormat sdf = new SimpleDateFormat("MMM ddyyyy hh:mm:ss z");
   sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
   System.out.println(sdf.format(calendar.getTime()));

No comments:

Post a Comment