我正在使用Tika提取文件的元数据,我发现文件的创建日期Tika提取始终以UTC时区显示。
我阅读了org.apache.tika.metadata.Metadata的源代码(Tika版本是0.9),我发现以下代码片段:
/**
* The ISO-8601 format string we use for Dates.
* All dates are represented as UTC
*/
private static final DateFormat iso8601Format =
createDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", "UTF");
/**
* Returns a ISO 8601 representation of the given date. This method is
* synchronized to prevent concurrent access to the thread-unsafe date
* formats.
*
* @see <a href="https://issues.apache.org/jira/browse/TIKA-495">TIKA-495</a>
* @param date given date
* @return ISO 8601 date string
*/
private static synchronized String formatDate(Date date) {
return iso8601Format.format(date);
}
有谁知道为什么Tika总是使用UTC时区格式化元创建日期?