获取到的时间格式是2016-8-19 怎么转换成2016-08-19啊
格式化的时候 月份 用 MM。。。。
格式化参数YYYY-MM-DD
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(sdf.parse("2016-8-19"));
DATE_FORMAT (datetime,FormatCodes ) /*使用formatcodes格式显示datetime*/
例如:DATE_FORMAT (datetime,'%Y-%m-%d')
参考自:
MySQL基本函数大全 http://www.data.5helpyou.com/article316.html
SimpleDateFormat formatdate = new SimpleDateFormat("yyyy-MM-dd");
String date = formatdate.format(formatdate.parse("2016-8-19"));
System.out.println(date);
如果是js的话,改怎么转?
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
System.out.println(sdf.format(sdf.parse("2016-8-19")));