Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
到目前为止我已经想过
位置 - 这有 getTime() 但我不知道如何将位置设置为字符串而不是设备位置
String citytocheck = edittext.gettext().toString();
citytocheck 是此处城市/国家/地区的名称
我怎样才能做到这一点?即使获得时区也可以。
你的意思是:
导入 java.text.SimpleDateFormat;导入 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)); } }