Java – calendar gettime() returns only est

Calendar cl =  Calendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles"));
Calendar cl =  Calendar.getInstance(TimeZone.getTimeZone("America/Los_Angeles"));
cl.setTimeInMillis(time); 
Toast.makeText(getActivity(),cl.getTime().toString(),Toast.LENGTH_LONG).show();

When do I always leave it in Eastern time I hope it can return time in PST Does anyone know that this may be wrong?

Attachment: my local time is est

Solution

Try this:

TimeZone.setDefault(TimeZone.getTimeZone("PST"));
Calendar cl = Calendar.getInstance();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>