0

I would like to see the following:

2021-12-20 13:29:30+03

So, i've added this option to layout property in FileTarget class:

${date:format=yyyy-MM-ddTHH\\:mm\\:ss}

...but i got this:

2021-12-20T13:29:30

What did I write wrong?

Chusya
  • 90
  • 2
  • 9
  • Isparia, this is the surprise. If you follow the link and compare how I wrote the format and how it is written there, then everything is correct. The question is why it doesn't work – Chusya Dec 20 '21 at 10:36
  • have you tried replacing the `"T"` in your format string with a `" "` ? – Franz Gleichmann Dec 20 '21 at 10:36
  • Franz Gleichmann, yes, i've tried, just this string: `2021-12-20 13:29:30`, without timezone – Chusya Dec 20 '21 at 10:38
  • no. think about it. you have a T in your output where you want a space instead. so you should replace the T in your pattern, which is not a placeholder but is literally interpreted as `T`, with a space. meaning: `${date:format=yyyy-MM-dd HH\\:mm\\:ss}` – Franz Gleichmann Dec 20 '21 at 10:41
  • Yes, I understood and edited my answer, sorry. – Chusya Dec 20 '21 at 10:42
  • 3
    and now add `zzz` => `${date:format=yyyy-MM-ddTHH\\:mm\\:sszzz}` to your format string and you should be golden – Isparia Dec 20 '21 at 10:45
  • Yes, i wrote like this: `${date:format=yyyy-MM-dd HH\\:mm\\:sszzzz}` and it works fine! Thank you! Happy New Year! – Chusya Dec 20 '21 at 10:50

0 Answers0