So far I have thought about
Location - this has getTime() but I don't know how to set the location as a string instead of device location
String citytocheck = edittext.gettext().toString();
citytocheck is the name of a city/country/location here
How can I accomplish this? Even getting the timezone would be fine.
Do you mean:
import java.text.SimpleDateFormat; import java.util.Date;
public class Main {
public static void main(String[] args) {
Date date = new Date();
SimpleDateFormat sdf;
sdf = new SimpleDateFormat("dd MMM yyyy hh:mm:ss zzz");
System.out.println(sdf.format(date));
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.