in , ,

Negative Absolute Value?

Negative Absolute Value? | code-memes, java-memes, class-memes, date-memes, validation-memes, datetime-memes, IT-memes, framework-memes | ProgrammerHumor.io
code-memes, java-memes, class-memes, date-memes, validation-memes, datetime-memes, IT-memes, framework-memes | ProgrammerHumor.io

Content

Subtracting the Date in Java This question may seem similar with others but actually it’s not the same case This code will return the difference in days between two dates, but it doesn’t return a negative number. Date currentdate calendar – getCurrentDate (); Date referencedate calendar.getDate(); long math Math.abs (currentdate. getTime () – referencedate. getTime ()); long result math (24 60 60 1000); System.out.println(result); I want to get a negative number in order to know if the current date is being subtracted from a past date or a future date. How to make this code return a negative number as well? OBS: I can’t use Date.after() or any other method from java.til Date because the framework I’m working with doesn’t allow me to use those methods, because it has its own Date class. java validation date datetime datepicker share edit asked 14 mins ago Rafa 116 06 have you tried giving a thought to use Joda which is a datetime library exclusively – Satya 12 mins ago 4 I wonder what Math.abs () does.. – shmosel 12 mins ago add a comment