Skip to content

Tag: date

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…

How to Validate Ordinal Dates?

My julian date is in 7 digit format YYYYDDD. I want to make sure all the scenarios of leap years should be covered. Currently I have put a check on days. Is there any utility validating it ? Answer I want to make sure all the scenarios of leap years should be covered. Currently I have put a check on

java.util.Date is parsing wrong dates with dates before 1912

I don’t understand the reason why Jackson library is parsing wrong dates before 1912. I suppose the problem is the java.util.Date conversion, because the problem persists with Gson. This is my code: date is a field of type java.util.Date As you can see, the input is: 1911-01-01T00:00:00+00:00 And the ou…