O'Reilly logo

Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions by Kishori Sharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Formatting Data

Java provides a rich set of APIs for formatting data. The data may include simple values such as a numbers or objects such as strings, dates, and other types of objects. In this chapter, you will learn

  • How to format and parse dates and numbers
  • How to use the printf-style formatting
  • How to create a class that uses a custom formatter

Formatting Dates

Java 8 provides a Date-Time API to work with dates and times, and to format and parse them. The Date-Time API was discussed in Chapter 12. If you are writing new code that is related to dates and times, you are advised to use the new Date-Time API. This section is provided in case you need to work with legacy code that uses old ways of formatting dates and time that existed before ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required