首页  >  问答  >  正文

java - nginx日期转换

nginx 日志的日期格式:27/Feb/2017:12:44:03 +0800

 SimpleDateFormat sourceFormat = new SimpleDateFormat("dd/MMM/yyyy:hh:mm:ss Z", Locale.ENGLISH);
 SimpleDateFormat transferFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 transferFormat.format(sourceFormat.parse(time));

用这种方式转换过来的是:2017-02-27 00:44:03

相差12小时怎么办?

PHP中文网PHP中文网2741 天前612

全部回复(0)我来回复

暂无回复
  • 取消回复