I want to compare 2 dates without the time, some posts in SO suggest to use Joda-Time API, but I don't understand how to use Joda-Time. I can't find any post that include how to declare, what package to be imported. and what does method getDateOnlyInstance() return? An integer or what?
How to use Joda-Time DateTimeComparator
2.3k Views Asked by Maya Nastasya At
1
There are 1 best solutions below
Related Questions in JAVA
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- TextToColumns function uses wrong delimiter
- Access Global not working
- Concatenate string and number as number
- How do I extract info from crunchbase
- Excel needs to pull substring values to variables
Related Questions in API
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- TextToColumns function uses wrong delimiter
- Access Global not working
- Concatenate string and number as number
- How do I extract info from crunchbase
- Excel needs to pull substring values to variables
Related Questions in DATE
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- TextToColumns function uses wrong delimiter
- Access Global not working
- Concatenate string and number as number
- How do I extract info from crunchbase
- Excel needs to pull substring values to variables
Related Questions in DATETIME-COMPARISON
- Import from api into multiple excel cells
- Loop through list of files and open them
- Pull and push data from and into sql databases using Excel VBA without pasting the data in Excel sheets
- Loop with equation for upper limit
- excel vba null value in array
- TextToColumns function uses wrong delimiter
- Access Global not working
- Concatenate string and number as number
- How do I extract info from crunchbase
- Excel needs to pull substring values to variables
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
As to how to use Joda API, google it, pretty basic stuff, you need to have the correct jar's on your classpath. Get the latest version of the jar here: http://sourceforge.net/projects/joda-time/files/joda-time/2.3/ (or use
maven
or some other build tool).What the
getDateOnlyInstance()
returns is a comparator, which when passed twoDateTime
-objects will compare them, but ignore the time-portion of the them, and only compare the dates (for instance, if you pass 2014-01-24 04:20:00 and 2014-01-24 13:37:00 they will be regarded as equal.)DateTime
is one of the central classes in JodaTime, and it is a representation of a date and a time (duh), much like thejava.util.Date
, but with one big difference:DateTime
is actually usable. You can do fun operations like adding and substracting days, hours and minutes, set the time-portion of it to midnight, and construct representations of dates without getting any grey hairs in the meantime.So download the zip for JodaTime from the link above, and place the
joda-time-2.3.jar
on your classpath, then you can use bothDateTime
and its comparator.