Saturday, July 23, 2022

How to Convert Date to String in Java with Example

As a Java developer we often need to convert java.util.Date or LocalDate to String in Java for  displaying purpose or sending Date as String in JSON or XML messages and that's where having a agree upon Date Format is very important. It easily allows you to convert your Date as String and pass between two System. I need it that while working on displaying date in my application and then I thought about this article to list down various way of converting this in various ways after some reading I found that SimpleDateFormat makes this quite easy. 

How to convert Date to LocalDate and LocalDateTime in Java 8 - Example Tutorial

The easiest way to convert a java.util.Date to java.time.LocalDate is via Instant, which is the equivalent class of java.util.Date in JDK 8. You can first convert util Date to Instant and then create a LocalDateTime object from that instant at your default timezone. Once you have an instant of LocalDateTime, you can easily convert that to LocalDate or LocalTime in Java. If you are not living under the rock in the last two years that its 2016 and Java 8 has been around for more than 2 years, 18th March 2014 Java SE 8 GA happened.

17 Examples of Calendar and Date in Java - Tutorial

The java.util.Calendar class was added in Java on JDK 1.4 in an attempt to fix some flaws of the java.util.Date class. It did make some tasks simpler, e.g. create an arbitrary date comes easier using the new GregorianCalendar(2016, Calendar.JUNE, 11) constructor, as opposed to the Date class where the year starts from 1900 and the Month was starting from zero. It didn't solve all the problems like mutability and thread-safety of Date class still remains, but it does make life easier at that time. Now with Java 8 everything related to Date and Time has become super easy and consistent but unfortunately, it will take another 5 to 10 years before the older version of Java goes away. Don't believe me, there are still applications running on JDK 1.5 which was released 12 years ago. The bottom line is it's still important to know about the Date and Calendar in Java.

Thursday, July 21, 2022

Review - Is Metaverse Professional Certification on 101 Blockchains worth it?

The metaverse is the next big thing, and you must have heard this a million times, just like many tech enthusiasts. The diverse elements of the metaverse have the potential to grab the attention of every person on the planet. Many big companies have already placed their stakes in the metaverse. Therefore, it is quite clear that a Certified Metaverse Professional certification would be helpful in terms of career development. Interestingly, the opportunities for career development in the metaverse have been doubling in recent times. The following discussion helps you find whether the CMP certification by 101 Blockchains is the best choice in metaverse certifications for you.

10 Difference between Java and JavaScript for Programmers

Programmers, developers, and internet users have always been confused between Java and JavaScript.  Many people still think that JavaScript is part of the Java platform, which is not true. In truth, JavaScript has nothing to do with Java, the only common thing between them is the word "Java", much like in Car and Carpet, or Grape and Grapefruit. JavaScript is a client-side scripting language for HTML, developed by Netscape, Inc, while Java is a programming language, developed by Sun Microsystems. James Gosling is the Inventor of Java, popularly known as the father of Java. 

How to get current URL, parameters and Hash tag using jQuery and JavaScript? Example

While dealing with the current URL, many times you want to know what is the current URL path, What are the parameters, and what is the hashtag on the URL. The hashtag is pretty important if you are implementing a tab structure using HTML and JQuery. To avoid confusion, let's take an example of a URL: http://javarevisited.blogspot.com/2013/01/top-5-java-programming-books-best-good.html#ixzz2PGmDFlPd, in this example ixzz2PGmDFlPd, is a hashtag. Now, both JavaScript and JQuery provide a convenient way to retrieve the current URL in the form of window.location object. You can use various properties of the window.location JavaScript object like the window.location.href to get complete URL, window.location.pathname to get the current path, and window.location.hash to get a hashtag from current URL.

Monday, July 18, 2022

How to format/parse dates with LocalDateTime in Java 8 - Example Tutorial

One of the common tasks in a Java project is formatting or parsing data to String and vice-versa. Parsing date means you have a String that represents a date like "2017-08-3" and you want to convert it into an object which represents the date in Java, like java.util.Date in pre-Java 8 world and LocalDate or LocalDatetime in Java 8 world. Similarly, formatting a date means converting a date instance into a String, for example, you have a Date object or LocalDatetime object and you want a String in dd-MM-yyyy format. Java 8 API provides good support for formatting and parsing dates.

Difference between Period and Duration class in Java 8? [Example]

What is the difference between Period and Duration class in Java is one of the popular Java 8 interview questions and has been asked too many of my readers recently. If you were also wondering the difference between Period vs Duration and when to use Period over Duration and vice-versa then you have come to the right place. Java 8 has two classes to represent differences in time like Duration and Period. The main difference between Period and Duration is that they represent the difference in different units, A Duration is used to calculate time difference using time-based values (seconds, millisecond, or hours) but Period is used to measure the amount of time in date-based values like days, months and year.

Friday, July 15, 2022

What is Double Brace Initialization in Java? Example Initializing HashMap and List with values in Java

Double brace initialization is a Java idiom to initialize a Collection like a list, set, and map at the time of declaration. At times, you need a list of fixed elements e.g. supported products, supported currencies, or some other config, and on-the-spot initialization reduces the line of code and improves readability. Double brace initialization idiom becomes popular because there is no standard way to create and initialize Collection at the same time in Java. Unfortunately, unlike other JVM languages like Scala and Groovy, Java doesn't support collection literals yet. 

Saturday, July 9, 2022

3 ways to Learn Redux Framework in depth in 2024 - Best of Lot

The state is a very important part of React development. In simple words, state is a plain JavaScript object that controls the behavior of a React component. If you want to become a professional React developer, then you must understand how to use the state efficiently. React provides inbuilt support for managing state but when the application grows, managing state becomes difficult. So the global state is created for an entire application and to manage such a global state, third-party state management libraries are used.

Thursday, July 7, 2022

Top 7 Pluralsight Courses for Data Scientists to Learn in 2024 - Best of Lot

Hello guys, if you are learning Data Science in 2024 and looking for best online courses to learn Data Science and Machine Learning or got a Pluralsight membership but are not sure which Pluralsight courses to join to better your Python, Data Science, Data Visualization, and other data-related skills then you have come to the right place. Earlier, I have shared the best Pluralsight courses to learn Java, Python, React.js, and JavaScript and today, I am going to share the best Pluralsight courses for Data Science and Data Scientists. These are my favorite Pluralsight courses on the topic as well and even if you are just starting with Data Science you can join these courses to learn a lot. 

Top 10 LinkedIn Learning Courses for Java and Web Developers in 2024 - Best of Lot

Hello guys, if you want to learn Java and Spring Framework in 2024 and are looking for the best LinkedIn learning online courses, you have come to the right place. Earlier, I shared the best Java and Spring Framework courses from Udemy, Coursera, and Pluralsight. This article will find the best Java, Spring, Spring Boot, and Microservices courses for Java developers.  LinkedIn Learning is an educational website by popular social networking site LinkedIn, where I think every Java developer should have their account. It has a lot of practical courses to learn essential skills and technology, and today, I will share the best LinkedIn Learning courses for Java and Spring Boot developers.

Right way to Close InputStream and OutputStream in Java - Example

For some unknown reasons many Java programmers are not very comfortable with IO package. I don't know why, but I have found them much more comfortable with java.lang and java.util than java.io. One possible reason of this could be that, writing IO code require a bit of C++ like programming, which involves doing clean-up, releasing resources once done etc. Since Java made coding a lot easier by taking care of memory management, unknowingly it also introduced bad practice of not releasing resource after use like database connections, socket connection, files, directory, printers, scanners or any other scarce resource.

Saturday, July 2, 2022

How to Learn Python Programming in 2024?

Hello guys, if you want to learn Python Programming language in 2024, one of the most popular programming language of this time but are not sure where to start then you have come to the right place. In the past, I have shared many Python resources like best Python Books, Courses, Projects, interview questions, and even best places to learn Python and  In this article, I am going to share with you the 3 best ways to learn Python programming from scratch. These are my tried and tested way to master any programming language or Framework and I have used this to learn Java, Python, JavaScript and many other technology. 

Top 10 Python Courses on Pluralsight for Beginners and Experienced Developers - Best of Lot

Hello guys, if you want to learn Python Programming language in 2022 and looking for the best Python online courses on Pluralsight then you have come to the right place. Earlier, I have shared the best Python books, Python 3 courses, and Python websites to learn Python programming and in this article, I am going to share the best Python courses from Pluralsight. If you don't know Pluralsight is a leading online learning platform where you get a chance to learn from expert trainers. They are known for their high-quality courses and they have more than 7500+ courses. They also have many projects and hands-on exercises and you can get access to them with just one Pluralsight membership.