Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用:
<layout class="PatternLayout"> <param name="ConversionPattern" value="%d{MM/dd/yy-HH:mm:ss}-t@%t-Inf-%m%n" /> </layout>
但我仍然得到一个完整的 4 位数的年份。有人熟悉获取 2 位数日期吗?
谢谢
这里没有运气。似乎这部分是从 Java 中匆忙翻译的SimpleDateFormat,因此它只处理 0 填充并且从不截断数字:
SimpleDateFormat
NumericToken::format() { // ... if ( initialLength + width > finalLength ) { s.insert( initialLength, ( initialLength + width ) - finalLength, (logchar) 0x30 /* '0' */); } }