To use the Joda-Time library in your code, you need to add the jar file (joda-time-2.2.jar) to the build path of the Eclipse. You can follow the step below to add the library to the project in Eclipse.
1. From the Project menu, select Properties.
2. On the properties window, select Java Build Path. Then select Add External Jars...
3. Browse to find the jar file that you have extracted. Then click OK.
If you are using the Windows' command prompt to compile and run your java program, you will need to the add the path of the jar file to the CLASSPATH by going to the Control Panel->System->Advanced System Settings. In the System Properties dialog, select Environment Variables. In the box under User variables, double-click CLASSPATH. Then append the path of the jar file to the Variable value text box. You will use the semi-colon (;) to separate each path entry.
Now you are ready to use the Jodatime library. To calculate the difference between two date times, you can use the Years.Years.yearsBetween, Months.monthsBetween, Days.daysBetween, Hours.hoursBetween, Minutes.minutesBetween, Seconds.secondsBetween methods. The example code below calculates the days and hours between the current and another future date.
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.Hours;
public class DateDiff {
public static void main(String[] args){
DateFormat formatter = new SimpleDateFormat("dd-MM-yyyyy");
Date futureDate=null;
Date today = Calendar.getInstance().getTime();
try{
futureDate= formatter.parse("30-10-2013");
}
catch(ParseException pe) {
System.out.println("Parser Exception");
}
Days days = Days.daysBetween(new DateTime(today),new DateTime(futureDate));
Hours hours=Hours.hoursBetween(new DateTime(today), new DateTime(futureDate));
System.out.println(" Days Between " + today + " and " + futureDate + " :" + days.getDays());
System.out.println(" Hours Between " + today + " and " + futureDate + " :" + hours.getHours());
}
}
If you would like to calculate the future date by adding a number of years, months, days, hours, minutes, seconds, or milliseconds to the current date, you will use the plusYears, plusMonths, plusDays, plusHours, plusMinutes, plusSeconds, or plusMillis methods of the DateTime class. Similarly, to find the past date, you can use the minusYears, minusMonths, minusDays, minusHours, minusMinutes, minusSeconds, or minusMillis methods. Read the example code below.
import java.util.Calendar;
import java.util.Date;
import org.joda.time.DateTime;
public class DateAdd{
public static void main(String[] args){
Date today = Calendar.getInstance().getTime();
DateTime dt=new DateTime(today);
DateTime futureDate=dt.plusDays(2); //add two days to the current date
System.out.println("The future date is "+futureDate);
}
}
![]() |
![]() |
Thanks for sharing informative article on java application development. Your post helped to understand the career in Java. JAVA Training in Chennai
ReplyDeleteThanks for your informative blog!!! Your article helped me to understand the future of .net programming language. Keep on updating your with such awesome information. .net training | dot net course Chennai
ReplyDeleteIn near future, big data handling and processing is going to the future of IT industry. Thus taking Hadoop Training in Chennai | Big Data Training in Chennai will prove beneficial for talented professionals.
ReplyDeleteHi admin,
ReplyDeleteI went through your blog, it’s totally awesome. Being most popular automation testing tool, selenium is used in automation software testing process. Selenium Course in Chennai | Best Selenium training institute in Chennai
Thanks for sharing such informative article on Loadrunner Automation testing tool. This load testing tool will provide most precise information about the quality of software. Loadrunner Course in Chennai | Loadrunner training institute in Chennai
ReplyDeleteInformation about JAVA have spread all over the world wide web, but this information is quite unique and attractive. Thanks for sharing it in here. Keep blogging
ReplyDeleteJAVA Training in Chennai
JAVA Training Chennai
Pretty Post! Vital piece of information, I had come to know about your web- from my friend Andria, Chennai I have read nearly seven posts of yours by now, and let me tell you, your post gives the useful and the most interesting information. This is just the kind of information that I had been looking for, I’m already your RSS reader now and I feel happy about it and I love learning more about this topic.
ReplyDeleteRegards,
ccna course in Chennai|ccna training in Chennai|ccna training institute in Chennai
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
ReplyDeleteRegards,
Python Training in Chennai|Angularjs training in chennai|Angular institutes in Chennai
Latest technology have created a greater impact over testing web applications. This vital in identifying important issues that raises in web appplications. Thanks for sharing this information in here. Keep blogging article like this.
ReplyDeleteSelenium training in chennai | Best selenium training institutes in chennai | Big Data Training Chennai
Software testing industry offer huge career opportunity for talented professionals. software testing course in Chennai
ReplyDeletePHP scripting is definitely one of the easiest, if not the easiest scripting language to learn and grasp for developers. This is partially due to the similarities PHP syntax has with C and Java. Even if the only knowledge of development that you have is with HTML, picking up PHP is still fairly easy.
ReplyDeletePHP training in Chennai|PHP training institute in Chennai|PHP course in Chennai
Thanks for sharing informative article on java application development. Your post helped to understand the career in Java. Java Training in Chennai
ReplyDeleteEveryone wants to get unique place in the IT industry’s for that you need to upgrade your skills, your blog helps me improvise my skill set to get good career, keep sharing your thoughts with us.
ReplyDeleteRegards,
sas training in Chennai|sas course in Chennai|sas training institute in Chennai
✔ PLC Training in Chennai
ReplyDelete✔ PLC Training Institute in Chennai
✔ PLC Training Center in Chennai
✔ PLC Training Course in Chennai
✔ PLC Course in Chennai
✔ PLC SCADA Training in Chennai
✔ PLC Training Centre in Chennai
✔ PLC SCADA Training Institute in Chennai
✔ Best PLC Training in Chennai
✔ Best PLC Training Institute in Chennai
✔ SCADA Training in Chennai
✔ DCS Training in Chennai
✔ Automation Training in Chennai
✔ Automation Training Institute in Chennai
✔ Industrial Automation Training in Chennai
✔ HMI Training in Chennai
✔ VFD Training in Chennai
✔ Process Automation Training in Chennai
✔ Final Year Projects in Chennai
✔ IEEE Projects in Chennai
✔ Mechanical Projects in Chennai
✔ Embedded Training in Chennai
✔ VLSI Training in Chennai
✔ Robotics Training in Chennai
✔ Inplant Training in Chennai
✔ AutoCad Training in Chennai
✔ IT Training institutes in Chennai
✔ Web Designing Training in chennai
Dear admin, The way you have explained the concept is mezmerizing. Thank you so much for sharing tis worth able content with us. The concept taken here will be useful for my future programs and i will surely implement them in my study. Keep blogging article like this.
ReplyDeleteJAVA J2EE Training in Chennai | JAVA Training in Chennai | Android training in chennai
Thanks for sharing detailed information of unified functional testing automation tool. QTP Course in Chennai | QTP training
ReplyDeleteI agree with your post. Android software development kit makes the application development process lot simpler and effective. You can create best performing android application with ease. Android Training Institutes in Chennai | Android Training in Chennai
ReplyDeleteJava Training in Chennai | Online Java Training India | Java Training Institutes in Chennai | Java J2EE Training Institutes in Chennai | IT Technical Articles
ReplyDeleteJava Training | Java Course in Chennai | Java Training Chennai | Online Java Training | Java Articles
ReplyDeleteawesome post about learning center,which is useful and valuable information to share with others.it was an most helpful library to know about java programming codes.
ReplyDeleteJAVA Training in Chennai
it was really good to know about these things , unique information and interesting too.
ReplyDeleteselenium training in chennai
Really a great article.! I love to read it once again. This was an amazing post. Thanks a lot for providing this unique post for our vision
ReplyDeleteSAS Training in Chennai
Really a great article
ReplyDeleteRegards,
Regards,
CCNA Training in Chennai | CCNA Training Institute in Chennai | Best CCNA Training in Chennai
Excellent write-up as well as excellent site, I enjoy these types of demanding content hold this unique somebody.App Buzz
ReplyDeleteThe strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The Struts, Spring, Hibernate are the advanced level of programming language which are most widely used.
ReplyDeletestruts training in chennai | struts training
Excellent post. Thanks for sharing such a useful post.
ReplyDeleteweb design training in chennai
Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteHadoop Training Chennai | PHP Training in Chennai
The usage of third party storage system for the data storage can be avoided in cloud computing and we can store, access the data through internet.
ReplyDeletecloud computing training in chennai | cloud computing courses in chennai
JMS Training Institutes in Chennai | JSP Training Institutes in Chennai | Java Spring Hibernate Training Institutes in Chennai | EJB Training Institutes in Chennai | Hibernate Training Institutes in Chennai |
ReplyDeleteJSF Training Institutes in Chennai | Java EE Training Institutes in Chennai | J2EE Training Institutes in Chennai | Core Java Training Institutes in Chennai | Java Training Institutes
Thanks for Sharing the valuable information and thanks for sharing the wonderful article..We are glad to see such a wonderful article..
ReplyDeleteQTP Training in Chennai | QTP Training Institute in Chennai | QTP Training
Excellent post. Thanks for sharing such a useful post.
ReplyDeleteJAVA TESTING TRAINING IN CHENNAI
• such a good website and given to more information thanks! and more visit...
ReplyDeleteJAVA TESTING TRAINING IN CHENNAI
I have read your blog and I got very useful and knowledgeable information from your blog. It’s really a very nice article Spring training In Chennai
ReplyDeleteWell Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
ReplyDeleteWeb Designing Course in Chennai | web designing training in chennai
Helpful post.Thanks for taking to share this.In a future everything is going to be automatic, connected and digital, embedded system engineer’s duty will be immense. An embedded system has great scope in future. Embedded Training in Chennai may get you placed in the good company.
ReplyDeleteRegards,
Embedded course in Chennai | AWS Training Institutes in Chennai | AWS Training center in Chennai
This data is great and amazing. A debt of gratitude is in order for taking an ideal opportunity to talk about this, I feel upbeat about it and I adore adapting more about this theme. I utilize your manual for teach my understudies.
ReplyDeleteThanks,
Selenium Training institute in Chennai | Selenium Training in Chennai | Selenium Training
Java is programming language which is used in almost all the applications and games which are on the web. Java is being used extensively and it will be used extensively in near future. So getting trained in Java will surely be helpful.
ReplyDeleteRegards,
Best JAVA Training in Chennai | JAVA Training | JAVA Training institutes in chennai
Very informative article..
ReplyDeletePretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
ReplyDeleteRegards,
Core JAVA Training in Chennai | JAVA Training in Chennai
Helpful post.Thanks for taking to share this
ReplyDeletesql server dba training in chennai
The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
ReplyDeleteDot net training in Chennai | dot net course in Chennai
ReplyDeleteGreat content thanks for sharing this informative blog which provided me technical information keep posting.
Selenium Training in Chennai | Selenium Testing Course in Chennai
Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
ReplyDeleteRegards,
AWS Training | AWS Training in Chennai
Embedded system training in chennai
ReplyDeleteEmbedded training in chennai
Best Embedded training in chennai
Bes Embedded System training in chennai
Embedded Course training in chennai
Automation training in chennai
Process automation training in chennai
BE Projects in chennai
final year projects in chennai
Mechanical project center in chennai
Wonderful Post. With one of a kind substance, I truly motivate enthusiasm to peruse this post. I trust this article help huge numbers of them who looking this pretty data.
ReplyDeleteRegards,
Java Training in Chennai | Java courses in Chennai | J2EE Training in Chennai
Im no expert, but I believe you just made an excellent You certainly understand what youre speaking about, and I can truly get behind that.
ReplyDeleteBest JAVA Training institute in Chennai|Java Courses in Chennai
In near future, big data handling and processing is going to the future of IT industry. Thus taking Hadoop Training in Chennai | Big Data Training in Chennai will prove beneficial for talented professionals.
ReplyDeleteAwesome post, I would definitely say that you have explained it very well with practical scenarios. please keep sharing such articles.
ReplyDeleteSelenium training in Chennai | Best Selenium training institute in Chennai
Thanks a lot.
.Net is most preferred programming language among software developers all over the world. It is also considered as most trusted and effective platform to build high performing desktop or enterprise application. DOT NET Training Institutes in Chennai
ReplyDeleteThanks for your informative article on Blogger. I think of creating my new website using blogger.
ReplyDeletePHP Training in Chennai
Thanks for sharing informative article on java application development. Your post helped to understand the career in Java.Java Training in Chennai
ReplyDeleteIn near future, big data handling and processing is going to the future of IT industry. Thus taking Hadoop Training in Chennai | Big Data Training in Chennai will prove beneficial for talented professionals.
ReplyDeleteI went through your blog and it’s totally awesome. Keep on updating your site with such informative post. If possible please include rss feed for your blog. Web designing Course in Chennai
ReplyDeleteFinding the time and actual effort to create a superb article like this is great thing. I’ll learn many new stuff right here! Good luck for the next post buddy..
ReplyDeletePHP training in chennai
Thanks for sharing informative articl. Your article helped me a lot to understand the concepts well. Salesforce Training in Chennai | Salesforce Training Institutes in Chennai
ReplyDeleteThanks for your informative blog!!! Your article helped me to understand the future of. Keep on updating your with such awesome information.Thank you so much for sharing tis worth able content with us. The concept taken here will be useful for my future programs . Keep blogging article like this.
ReplyDeletesoftwaretesting Training in chennai
I agree with your thoughts!!! As the demand of java programming application keeps on increasing, there is massive demand for java professionals in software development industries. Thus, taking training will assist students to be skilled java developers in leading MNCs.
ReplyDeleteJava Training in Chennai
Thanks for your informative blog!!! Your article helped me to understand the installation process of .net programming language. Keep on updating your with such awesome information. best DOT NET Training in Chennai | .net course in Chennai
ReplyDelete
ReplyDeleteI have been reading your blog posts. You blog posts are awesome. They provide good and extremely information which is more valuable. Selenium Training in Chennai is predominant famous for Selenium Automation Training and how to get the necessary knowledge about the technology and implement it in a effective way.
I went through your blog and it’s totally awesome. Keep on updating your site with such informative post. If possible please include rss feed for your blog. Web designing Course in Chennai
ReplyDeleteThanks for sharing informative article!!! Your article helped me a lot to understand the importance of PHP Training in Chennai to secure lucrative job in web design and development industry.
ReplyDeleteInformative article on responsive website design!!! With the expansion of mobile phones, most of us access internet from our mobile and other portable gadgets. Having responsive website for your business will help you to target customers widely. web designing course | Web designing course in Chennai | website design in Chennai
ReplyDeleteThis article provides the information about Java its key features and scope for java professionals. This information is really helpful me to know more about Java programming language. Java Training in Chennai | Java Training | Java Course in Chennai
ReplyDeleteThanks for sharing such informative guide on .Net technology. This post gives me detailed information about the .net technology. I am working as trainer in leading IT training academy offering Dot Net Training in Chennai and i use your guide to educate my students. .Net Training in Chennai
ReplyDeleteThis topic has always been one of my favorite subjects to read about. I have found your post to be very rousing and full of good information. I will check your other articles shortly.
ReplyDeletelimo service va
nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge. so keep on sharing such kind of an interesting blogs.
ReplyDeletesoftware testing training in chennai
Good one, very informative.. thanks for sharing your views and ideas.. it is very useful to me.. thanks once again.
ReplyDeleteDot Net Training in chennai |
Dot Net Training institute in chennai
Thanks a lot! You made a new blog entry to answer my question; I really appreciate your time and effort.
ReplyDeletecore java training in chennai |
Top 10 java training institute in chennai
Good and nice blog post, thanks for sharing your information.. it is very useful to me.. keep rocks and updating.
ReplyDeleteJava Training in chennai
Thank you for sharing this informative blogs with us.Bigdata hadoop training in chennai
ReplyDeleteThanks for sharing informative article. Download Windows 7 ultimate for free from getintopc. It helps you to explore full functionality of windows operating system.
ReplyDeleteYour good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeletehttp://www.trainingbangalore.in/big-data-analytics-training-in-bangalore.html
Thanks a lot very much for the high your blog post quality and results-oriented help. I won’t think twice to endorse to anybody who wants and needs support about this area.
ReplyDeletedatascience training in chennai
It is very useful information. It will help to improve my knowledge in Selenium. Thank you for sharing this awesome site.
ReplyDeleteSelenium Training in Chennai | Selenium Training | Selenium Course in Chennai | Selenium Training Institute in Chennai
Great blog, Thank you for giving this valuable information.
ReplyDeleteDot Net Training in Chennai | Angularjs Training in Chennai
Good stuffs from this blog I got very interesting points in this article
ReplyDeleteThanks for sharing this concepts admin. Really helpful.
ReplyDeleteAWS Training in Chennai
ccna Training in Chennai
RPA Training in Chennai
Robotics Process Automation Training in Chennai
Azure Training in Chennai
UiPath Training in Chennai
I am feeling grateful to read this. you gave a nice info for us.please update more stories.
ReplyDeleteAngular 6 Training in Chennai
RPA Training in Chennai
DevOps Training
Java Training in Chennai
Python Online training
I am really enjoying reading your well written articles.
ReplyDeleteIt looks like you spend a lot of effort and time on your blog.
I have bookmarked it and I am looking forward to reading new articles. Keep up the good work..
hadoop institute in bangalore
best institute for bigdata in bangalore
big data coaching in bangalore
Core Java Training in Bangalore
Best Java Training in Bangalore
Advanced Java Training in Bangalore
Thank you for sharing this post.
ReplyDeleteArticle submission sites
Education
Nice article. I liked very much. All the informations given by you are really helpful for my research. keep on posting your views.
ReplyDeleteSalesforce Administrator 201 Training in Chennai
Salesforce Administrator 211 Training in Chennai
Salesforce Developer 401 Training in Chennai
Cloud computing Training in Chennai
Cloud computing Training
Cloud computing Training near me
Informative post,It is useful for me to clear my doubts.I hope others also like the information you gave in your blog.
ReplyDeleteAWS Training in Vadapalani
AWS Training in Mogappair
AWS Training in Bangalore
AWS Training
Nice post. Thanks for sharing such a recent updates.
ReplyDeleteSpoken English in Bangalore
Spoken English Institutes in Bangalore
Spoken English Coaching Classes near me
English Speaking Classes in Bangalore
Spoken English Coaching in Bangalore
Spoken English Training Institute in Bangalore
Best Spoken English Coaching in Bangalore
This is really too useful and have more ideas and keep sharing many techniques. Eagerly waiting for your new blog keep doing more.
ReplyDeleteBest Institute For Java Training In Bangalore
Java J2ee Courses In Bangalore
Aws Classes in Bangalore
Aws Cloud Training in Bangalore
Aws Coaching Centre in Bangalore
Wonderful concept! These was very helpful for enhance my knowledge. I am reading your post regularly, it's very interesting. Please posting.
ReplyDeleteEthical Hacking Certification in Bangalore
Learn Ethical Hacking in Bangalore
Best Ethical Hacking Training in Bangalore
Ethical Hacking Training in Chennai Adyar
Hacking Training in Adyar
Ethical Hacking Training in Nungambakkam
Ethical Hacking Course in Saidapet
ReplyDeleteYour post is great. It shows your deep understanding of the subject. Waiting for your future posts.
Pega training in chennai
Pega course in chennai
Pega training institutes in chennai
Pega course
Pega training
SAS Training in Chennai
SAS Course in Chennai
IELTS Coaching in Chennai
IELTS Training in Chennai
Amazing article. Your blog helped me to improve myself in many ways thanks for sharing this kind of wonderful informative blogs in live. I have bookmarked more article from this website. Such a nice blog you are providing ! Kindly Visit Us @ Best Travels in Madurai | Tours and Travels in Madurai | Madurai Travels
ReplyDeleteAmazing post very useful
ReplyDeleteAb Initio training class in chennai
Very good to read thanks for posting
ReplyDeleteblue prism training class chennai
Thank you for excellent article.
ReplyDeletePlease refer below if you are looking for best project center in
coimbatore
http://www.trainingincoimbatore.in/final-year-projects-in-
coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-cse-in-
coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-it-in-
coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-ece-in-
coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-eee-in-
coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-
mechanical-in-coimbatore.html
http://www.trainingincoimbatore.in/final-projects-for-
instrumentation-in-coimbatore.html
Thank you for excellent article.
ReplyDeletePlease refer below if you are looking for best project center in
coimbatore
http://www.trainingincoimbatore.in/final-year-projects-in-coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-cse-in-coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-it-in-coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-ece-in-coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-eee-in-coimbatore.html
http://www.trainingincoimbatore.in/final-year-projects-for-mechanical-in-coimbatore.html
http://www.trainingincoimbatore.in/final-projects-for-instrumentation-in-coimbatore.html
ReplyDeletefinal year projects in coimbatore
final year projects for CSE in coimbatore
final year projects for IT in coimbatore
final year projects for ECE in coimbatore
final year projects for EEE in coimbatore
final year projects for Mechanical in coimbatore
final year projects for Instrumentation in coimbatore
Very Nice Article to read. Blog articles helped me alot in many ways to find the good solution. Am very happy to comments here. Thanks for sharing this kind of wonderful article in this blog. Lovely ! CCTV Camera Supplier | MATRIX dealers
ReplyDelete