From the course: Java 8 Essential Training
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Working with dates and times - Java Tutorial
From the course: Java 8 Essential Training
Working with dates and times
- There are two completely different APIs for working with dates and times in Java: the original set of classes that were introduced with Java in the mid-90s, and a completely new date-time API that was brought in with Java 8. If you're working on, say, a Java Enterprise Edition application and you're working with a Java 8 runtime, then you can use the new API. But if you're working in older versions of Java or if you're working in Android, which doesn't yet implement Java 8 features, then you'll need to use the older classes. I'm working in the project DatesAndTimes, which has a main class with an empty main method. And I'll start with the original date API. I'll create an instance of the Date class, which is a member of the java.util package. Because it's not a member of java.lang, it must be imported in order to use it. I'll name my object d and then I'll instantiate with new and then the constructor method, date. There are a number of different versions of this constructor method,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Working with object data types6m 27s
-
Using the String class5m 5s
-
Converting primitive values to strings4m 15s
-
Building a string from multiple values8m 44s
-
Comparing string values5m 51s
-
Formatting numeric values as strings4m 41s
-
Parsing string values3m 13s
-
Working with dates and times8m 35s
-
Challenge: Creating a simple calculator application1m 28s
-
Solution: Creating a simple calculator application1m 19s
-
-
-
-
-
-
-
-
-