Repository navigation
Document the PatternLayout date time zone and strftime options - #857
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
DatePatternConverter accepts a second option selecting the time zone (GMT or an offset from GMT such as GMT+10 or GMT-05:30) and formats the date using strftime when the date format specifier contains a '%' character. Both options were only described in the DatePatternConverter constructor documentation, so the PatternLayout reference gave no way to discover how to output timestamps in UTC. Describe both options, with examples, in the "d" row of the PatternLayout conversion table and list the "date" alias. Fixes apache#856
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #856
Problem
The
drow of the PatternLayout conversion table leaves out two options thatDatePatternConverteralready supports. They are only described in theDatePatternConverterconstructor documentation:%d{ISO8601}{GMT}) or a fixed offset (%d{HH:mm}{GMT+10},%d{HH:mm}{GMT-05:30}). Without it, the local time zone is always used.%is formatted withstrftime, e.g.%d{%Y-%m-%d %H:%M:%S}.The
datealias ofdwas not listed either.Change
The
drow now has a paragraph for each option with an example, and lists thedatealias. The change is documentation only.Testing
I checked the documented behaviour with a program linked against the current master, run with
TZ=America/New_York(local time 22:51, UTC 03:51):%d{ISO8601}2026-12-04 22:51:01,982%d{ISO8601}{GMT}2026-12-05 03:51:01,983%d{HH:mm}{GMT+10}13:51%d{HH:mm}{GMT-05:30}22:21%d{%Y-%m-%d %H:%M:%S}2026-12-04 22:51:01%d{%Y-%m-%d %H:%M:%S}{GMT}2026-12-05 03:51:01PatternParserTestCase::testMultiOptionalready covers the time zone option.