android 格林尼治标准时间的 格式转换 (String To Date) 报错 java.text.ParseException: Unparseable date
来源:互联网 发布:仿微信红包源码 编辑:程序博客网 时间:2024/06/05 20:00
首先 Mon Dec 09 22:06:24 格林尼治标准时间+0800 2013 字段一个格林尼治标准时间时间,一般情况下字段中不会含有中文,对于这种格式有两种解决方法
1剔除中文字符串
public static String convertGMTToLoacale(String gmt){
String cc = gmt.substring(0, 19) + gmt.substring(33, 38);
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy",new Locale("English"));
try {
Date date = sdf.parse(cc);
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM");
String result = dateformat.format(date);
return result;
} catch (ParseException e) {
}
return "";
}
2.第二种方法是在不进行字符串剔除的情况下:
在simpleDateFormat方法中将格式字符串变换为:"EEE MMM dd HH:mm:ss 格林尼治标准时间+0800 yyyy" 就可以了。这样就可一将时间转换为Date类型:
private DateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss 格林尼治标准时间+0800 yyyy",Locale.ENGLISH);
http://blog.csdn.net/kernel_32/article/details/17770943
- android 格林尼治标准时间的 格式转换 (String To Date) 报错 java.text.ParseException: Unparseable date
- 【Java报错】java.text.ParseException: Unparseable date
- jeecms 报错 java.text.ParseException: Unparseable date
- java.text.ParseException: Unparseable date:
- java.text.ParseException: Unparseable date
- java.text.ParseException: Unparseable date:
- java.text.ParseException: Unparseable date
- java.text.ParseException: Unparseable date:
- java.text.ParseException: Unparseable date:
- java.text.ParseException: Unparseable date
- 遇到的问题------------时间格式转化时java.text.ParseException: Unparseable date: ""异常
- Datetimepicker 提示java.text.ParseException: Unparseable date:
- java.text.parseexception:unparseable date异常
- 异常--java.text.ParseException: Unparseable date
- Error when passing date to create solr date format.java.text.ParseException: Unparseable date: "Wed
- java异常,java.text.ParseException: Unparseable date: "",原因
- 关于java String格式 转Date格式 SimpleDateFormat 报java.text.ParseException 错误
- java字符串转换成时间Unparseable date错误的解决方案
- Android应用的源代码
- Visual Basic 6.0安装教程
- 九度OJ 1351 数组中只出现一次的数字
- 一台电脑同时运行多个tomcat配置方法
- 窗体项目。所以Visual Basic中的控件大多和窗体项目有关。
- android 格林尼治标准时间的 格式转换 (String To Date) 报错 java.text.ParseException: Unparseable date
- Android应用资源
- C指针原理(89)-LINUX应用(2)-线程池
- HTML5 Form Attributes
- jbpm4.4+mysql 乱码问题
- JAVA中request.getParameterMap()用法笔记
- TIME_WAIT状态
- 新手必看:究竟哪种编程语言最有前途?
- 计算机程序