O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

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

Using time within an EJB

Time is a complex topic with many aspects of time being beyond the scope of this book. Within this recipe, we will examine several common problems that can occur when working with time in a Java EE application.

Getting ready

To use time in a Java application we normally use a Date instance in conjunction with a Calendar instance. The Date object represents a time while the Calendar instance maps it to a specific calendar system.

Normally we will use the DateFormat or a DateFormat derived class to convert a time into a string for display purposes. While the use of these classes appears straightforward, there are several areas where a developer can go astray.

Time is represented using an instance of the Date class. However, ...

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