Skip to content Skip to sidebar Skip to footer

How Can I Get Los Angeles (usa) Current Time Programmatically In Android?

Hi i developing a application in android. i need to use the Los Angeles (USA) location current time, date. For that I used the below code Calendar calendar = Calendar.getI

Solution 1:

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

FYI, a Date is nothing more than a specific instant in time .


Post a Comment for "How Can I Get Los Angeles (usa) Current Time Programmatically In Android?"