Skip to Main Content
Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions
book

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

by Kishori Sharan
June 2014
Beginner content levelBeginner
810 pages
23h 28m
English
Apress
Content preview from Beginning Java 8 Fundamentals: Language Syntax, Arrays, Data Types, Objects, and Regular Expressions

Formatting Dates and Times

An object of the DateTimeFormatter class lets you format and parse a datetime object. By formatting, I mean representing a datetime object in a user-defined textual form, for example, representing a LocalDate May 24, 2012 as “05/24/2012.” Sometimes formatting is also referred as printing, because formatting features also let you print (or output) a textual representation of a datetime object to an Appendable object such as a StringBuilder.

Parsing is the reverse of formatting. It lets you construct a datetime object from a textual representation of a datetime. Creating a LocalDate object from the text “05/24/2012” to represent May 24, 2012 is an example of parsing.

Different ways of formatting and parsing datetimes ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions

Beginning Java 9 Fundamentals: Arrays, Objects, Modules, JShell, and Regular Expressions

Kishori Sharan

Publisher Resources

ISBN: 9781430266532Purchase book