GitHub user ashr123 edited a comment on the discussion: Getting current
date-time format (or default format)
Yes, certainly right now I execute the following code:
```java
private static final DateTimeFormatter DATE_TIME_FORMATTER =
DateTimeFormatter.ofPattern(
FixedDateFormat.FixedFormat.DEFAULT.getPattern(),
Locale.getDefault(Locale.Category.FORMAT)
)
.withZone(ZoneId.systemDefault());
```
and later on I'm use it as follows:
```java
private static void printAlert(long contentLength,
TemporalAccessor alertsLastModified,
String translatedTitle,
String translatedDescription,
CharSequence output) {
System.out.println("Translated Title: " + translatedTitle +
System.lineSeparator() +
"Translated Description: " + translatedDescription +
System.lineSeparator() +
"Content Length: " + contentLength + " bytes" +
System.lineSeparator() +
"Last Modified Date: " +
DATE_TIME_FORMATTER.format(alertsLastModified) + System.lineSeparator() +
"Current Date: " + DATE_TIME_FORMATTER.format(Instant.now()) +
System.lineSeparator() +
output);
}
```
So at the end, the output is:
> ```
> Translated Title: Rocket and Missile Attack
> Translated Description: Enter the Protected Space
> Content Length: 156 bytes
> Last Modified Date: 2025-06-26 17:42:37,000
> Current Date: 2025-06-26 17:42:39,097
> Translated Areas and Districts:
> Gaza Envelope:
> 15 seconds:
> Yated
> ```
GitHub link:
https://github.com/apache/logging-log4j2/discussions/3788#discussioncomment-13601169
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]