Hello Thorsten Schöning,

thank you for your quick answer.

On 12/01/2016 05:34 PM, Thorsten Schöning wrote:
Guten Tag Felix Endres,
am Donnerstag, 1. Dezember 2016 um 16:37 schrieben Sie:

is it possible to print a unix timestamp, i.e. seconds since 1970 in the
PatternLayout (or any other layout)? Optimally I would like a fractional
pattern showing microseconds.
Is your question about the format or timezone handling? A format
including fractionals is possible and the default already when only
using "%d", but I'm pretty sure it's not supporting microseconds:
It's actually not about timezone handling. With timestamp I meant something like "1480614212.833892332", which is commonly used on unix, at least the integer seconds part.

%d{yyyy-MM-dd HH:mm:ss,SSS}
2016-12-01 17:20:43,764
Have a look at the classes datepatternconverter, strftimedateconverter
and simpledateformat, which is used depending on your configuration
and might support timezone related stuff. At least there some "Z"
mentioned in simpledatformat, resulting in a calculation of timezone
offsets in "RFC822TimeZoneToken".
I guess Robert Middleton's answer works for me. I may look into the classes you mention for microseconds though.


Sitz der Gesellschaft: Roboception GmbH, Kaflerstr. 4, 81241 München
Registereintrag: Amtsgericht München HRB 217783
Geschäftsführer: Dr. Michael Suppa
USt. Ident. Nr.: DE299379772

Reply via email to