Skip to content
Advertisement

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 GMT On Linux: the time is

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 output is: Sun Jan 01 00:09:21 CET 1911 (I don’t understand

How to get list of months between two dates in Java

I am trying to get a list of months (actually the first days of those months) between two dates in Java but I am not getting the expected results. The start date is “3/17/2020”, the end date “3/17/2021” and the expected result is as follows: Here below is the code I am using: With the above code I am getting

Advertisement