O'Reilly logo

Inside JavaScript by Steven Holzner

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

Chapter 18. The Date, Time, and String Objects

The Date, Time, and String Objects

In this chapter, we’ll take a look at two important JavaScript objects: the Date and String objects. Both are fairly extensive, and both are useful. As you can guess from their names, the Date object enables you to work with dates, and the String object enables you to work with strings. I’ll discuss the Date object in detail first.

The Date Object

Date objects store dates and provide many methods to extract the hours, minutes, and so on parts of dates. There are a number of different ways to create Date objects, such as the following:

 var date1 = new Date() var date1 = new Date(dateVal) var date1 = new ...

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