android得到系统时间如何判断是白天还是晚上

来源:互联网 发布:js重置 编辑:程序博客网 时间:2024/05/01 00:27
ContentResolver cv = getBaseContext().getContentResolver();String strTimeFormat = android.provider.Settings.System.getString(cv, android.provider.Settings.System.TIME_12_24);if(strTimeFormat!=null && strTimeFormat.equals("24")){Log.i("Debug","24小时制");}else{String amPmValues;Calendar c = Calendar.getInstance(); if(c.get(Calendar.AM_PM) == 0){amPmValues = "AM";}else{amPmValues = "PM";}Log.i("Debug","12小时制现在是:" + amPmValues);} 

0 2
原创粉丝点击