Skip to content

Tag: datetime

Getting the UTC timestamp in Java

An old Stack Overflow posting suggests that the way to get the UTC timestamp in Java is the following: Unfortunately this does not work for me. I have a very simple program (reproduced below) which demonstrates different behavior. On Windows: the time is the local time and it is labeled with the offset with G…

Java DateTimeFormatter parsing with special characters

I’m having some troubles getting my format right for using DataTimeFormatter to parse a date time String in the format of: I have a DateTimeFormatter pattern that works to produce this format, but it doesn’t work to parse the same String. That pattern is: If there are other libraries for DateTime …

How to force LocalDateTime Month to be 3 letters long

My goal is to use LocalDateTime and display a month with exactly 3 letters. For the English language, this is easy: The result is as expected: For the German language (as above, only with Locale.GERMAN), the result is unexpected: While the abbreviations are all common in german, “März”, “Jun…