How to subtract two calendar object in Android
Say for example I have two calendar object with the format of "MM/dd/yyyy". How do I subtract them and should return the number of days? For example, "9/7/2014" - "9/1/2014" and returns 7. Calendar calendar = Calendar.getInstance(); Calendar today = Calendar.getInstance();
You may try like this: Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_MONTH,7); calendar.set(Calendar.MONTH,8); calendar.set(Calendar.YEAR, 2014); Calendar today = Calendar.getInstance(); long difference = today.getTimeInMillis() - calendar.getTimeInMillis(); int days = (int) (difference/ (1000*60*60*24));
How to track user interaction when a dialog is shown?
Way to drag listview items till middle when reached bottom
how to make a connection via bluetooth with phonegap 3.5.0 to an Arduino?
How can I limit the length of content in the webview?
How to print out all contents of Facebook GraphUser object on Android?
Save google map for offline use
How to apply Undo and Redo operation to EditText on Button click in android
Load image from file on HTC
What are the specific conditions that cause Unity3D's AndroidJavaClass to throw on new?
I want to set the dimension dynamically from the layout file, is it possible to load the action bar size in dimension file?
XEP-0167, libjingle_peerconnection.jar and my application
Pass specific TouchEvent to specific view
Android ImageButton - How to hide the image while showing the background?
How to add an ImageLoader in android
how to select multiple items in a listview populated from ArrayList in Android
Change menu text android