标签云

微信群

扫码加入我们

WeChat QR Code

Is there a Java equivalent of DateTime.MinValue and DateTime.Today in the Java Date class? Or a way of achieving something similar?

I've realised how spoilt you are with the .NET datetime class, I also need the equivalent of AddDays(), AddMonths().


See also, Java: What/where are the maximum and minimum values of a GregorianCalendar?.

2018年08月16日23分41秒

+1. Java built in dates are bad. Take the 3 extra seconds to build around Joda time, and you will be much happier.

2018年08月16日23分41秒

I've heard of Jon Skeet's api, but is this android friendly?

1970年01月01日00分03秒

I believe it is completely android-friendly. (Jon Skeet has made a port of JodaTime to .NET (noda-time))

2018年08月16日23分41秒

I thought Joda time was his not Noda time, I'll give it a try

2018年08月16日23分41秒

I could just use the epoch as the min value (I'm looking for something to indicate no date has been set), I'm not so sure about the opposite though

2018年08月16日23分41秒

this doesn't answer his question.

2018年08月16日23分41秒

Bozho, as Chris has understood I was attempting to point him in the right direction for date manipulation with core Java.

2018年08月16日23分41秒

well, fine. Just to note that the downvote is not mine.

2018年08月15日23分41秒

I didn't think it was Bozho, I've read enough of your answers that you don't strike me as that petty. I admit the answer could have had much more detail but I didn't really have time.

2018年08月15日23分41秒