>  Q&A  >  본문

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일 전615

모든 응답(0)나는 대답할 것이다

답장 없음
  • 취소회신하다