impala 字符串转日期
- 作者: 人松外号鬼见愁
- 来源: 51数据库
- 2020-10-04
public static Date str2dateEx(String strValue) throws ParseException {
if (strValue == null)
throw new ParseException("字符串为空", 0);
Date theDate;
SimpleDateFormat theFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
theDate = theFormat.parse(strValue);
return theDate;
}
java中将字符串转换成日期类型,可以使用simpledateformat日期转换类,有一个前提是字符串必须满足日期的格式,如果不是会有异常
=left(a1,2)&":"&mid(a1,3,2)&":"&mid(a1,5,2)&":"right(a1,4)
if (strValue == null)
throw new ParseException("字符串为空", 0);
Date theDate;
SimpleDateFormat theFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
theDate = theFormat.parse(strValue);
return theDate;
}
java中将字符串转换成日期类型,可以使用simpledateformat日期转换类,有一个前提是字符串必须满足日期的格式,如果不是会有异常
=left(a1,2)&":"&mid(a1,3,2)&":"&mid(a1,5,2)&":"right(a1,4)
推荐阅读