时间日期格式化
来源:互联网 发布:php网站上传到服务器 编辑:程序博客网 时间:2024/06/01 13:37
SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.US);
java.text.SimpleDateFormat
getLongDateFormat
Date dummyDate = mDummyDate.getTime();
Log.i(TAG, "date format: " + shortDateFormat.format(dummyDate));
// if (format != null && !format.equals("")) {
SimpleDateFormat formatter = new SimpleDateFormat(shortDateFormat.format(date));
String mTimestampd = formatter.format(date);
SimpleDateFormat dateFormatter = new SimpleDateFormat(strTimeFormat);
time = dateFormatter.format(Calendar.getInstance().getTime());
Log.d(TAG, "Enable GPS time sync");getDateInstanceSHORT
---------------------------------------------------------------------------------------------
for (int i = 0; i < formattedDates.length; i++) {
SimpleDateFormat sdf= new SimpleDateFormat(dateFormats[i], Locale.US);
String formatted=sdf.format(mDummyDate.getTime());
//String formatted =
// DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i])
// .format(mDummyDate.getTime());
if (dateFormats[i].length() == 0) {
formattedDates[i] = getResources().
getString(R.string.normal_date_format, formatted);
} else {
formattedDates[i] = formatted;
}
}
mDateFormat.setEntries(formattedDates);
}
-----------------------------------------------------------------------------------------------
updateTimeAndDateDisplay(getActivity());
String format = preferences.getString(key,
getResources().getString(R.string.default_date_format));
SimpleDateFormat dateFormatter = new SimpleDateFormat(format);
Settings.System.putString(getContentResolver(),
Settings.System.DATE_FORMAT, dateFormatter.format(Calendar.getInstance
().getTime()));
Log.d(TAG, "dateFormatter"+dateFormatter.format(Calendar.getInstance().getTime
()));
//updateTimeAndDateDisplay(getActivity());
-----------------------------------------------------------------------------------------------
Log.d(TAG, "mDatePref.setSummary"+DateFormat.getDateFormat(context).format(now.getTime()));
Log.d(TAG, "mTimePref.setSummary"+DateFormat.getTimeFormat(getActivity()).format
(now.getTime()));
Log.d(TAG, "mDateFormat.setSummary"+shortDateFormat.format(dummyDate));
<item>yyyy-mmm-dd</item>
<item>MM-dd-yyyy</item>
<item>dd-MM-yyyy</item>
<item>yyyy-MM-dd</item>
<item>EE-MMM-d-yyyy</item>
<item>EE-d-MMM-yyyy</item>
<item>yyyy-MMM-d-EE</item>
<item>yyyy-MMM-d</item>
<item>yyyy-d-MMM</item>
<item>EEEE-MMMM-d</item>
java.text.SimpleDateFormat
getLongDateFormat
Date dummyDate = mDummyDate.getTime();
Log.i(TAG, "date format: " + shortDateFormat.format(dummyDate));
// if (format != null && !format.equals("")) {
SimpleDateFormat formatter = new SimpleDateFormat(shortDateFormat.format(date));
String mTimestampd = formatter.format(date);
SimpleDateFormat dateFormatter = new SimpleDateFormat(strTimeFormat);
time = dateFormatter.format(Calendar.getInstance().getTime());
Log.d(TAG, "Enable GPS time sync");getDateInstanceSHORT
---------------------------------------------------------------------------------------------
for (int i = 0; i < formattedDates.length; i++) {
SimpleDateFormat sdf= new SimpleDateFormat(dateFormats[i], Locale.US);
String formatted=sdf.format(mDummyDate.getTime());
//String formatted =
// DateFormat.getDateFormatForSetting(getActivity(), dateFormats[i])
// .format(mDummyDate.getTime());
if (dateFormats[i].length() == 0) {
formattedDates[i] = getResources().
getString(R.string.normal_date_format, formatted);
} else {
formattedDates[i] = formatted;
}
}
mDateFormat.setEntries(formattedDates);
}
-----------------------------------------------------------------------------------------------
updateTimeAndDateDisplay(getActivity());
String format = preferences.getString(key,
getResources().getString(R.string.default_date_format));
SimpleDateFormat dateFormatter = new SimpleDateFormat(format);
Settings.System.putString(getContentResolver(),
Settings.System.DATE_FORMAT, dateFormatter.format(Calendar.getInstance
().getTime()));
Log.d(TAG, "dateFormatter"+dateFormatter.format(Calendar.getInstance().getTime
()));
//updateTimeAndDateDisplay(getActivity());
-----------------------------------------------------------------------------------------------
Log.d(TAG, "mDatePref.setSummary"+DateFormat.getDateFormat(context).format(now.getTime()));
Log.d(TAG, "mTimePref.setSummary"+DateFormat.getTimeFormat(getActivity()).format
(now.getTime()));
Log.d(TAG, "mDateFormat.setSummary"+shortDateFormat.format(dummyDate));
<item>yyyy-mmm-dd</item>
<item>MM-dd-yyyy</item>
<item>dd-MM-yyyy</item>
<item>yyyy-MM-dd</item>
<item>EE-MMM-d-yyyy</item>
<item>EE-d-MMM-yyyy</item>
<item>yyyy-MMM-d-EE</item>
<item>yyyy-MMM-d</item>
<item>yyyy-d-MMM</item>
<item>EEEE-MMMM-d</item>
0 0
- 格式化时间日期函数
- 时间日期格式化
- JAVA格式化时间日期
- 格式化时间日期
- .net日期时间格式化
- 时间日期格式化操作
- rails 格式化日期时间
- 格式化 日期时间 DateTime
- Mysql 格式化日期/时间
- C#格式化日期时间
- Mysql 格式化日期/时间
- C#日期格式化,时间
- JAVA格式化日期时间
- Python格式化日期时间
- C#日期时间格式化
- C#日期时间格式化
- Python 日期时间格式化
- 正确格式化日期、时间
- C#_Soap调用webservice服务
- VxWorks BSP宏梳理
- 一个超级炫酷的链接特效
- 网络客户端工具
- 菜鸟调错(十一)——POI导出Excel报错No such file or directory
- 时间日期格式化
- Python for Data Analysis(4)
- Java中窗口最小化到系统托盘
- Linux-C基础知识学习:C语言作业-用switch语句实现——成绩分等级,90+:优 80~89良上,70~79良,60~69及格,<60不及格
- mysqldump工具的详细介绍
- echo(),print(),print_r()之间的区别?
- 【uva 12549】Sentry Robots HDU 2119 (hdu 2119Matrix升级版) 最小点覆盖+二分图匹配
- JAVA内存模型(Java Memory Model)
- 堆和栈的区别