spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column25


Changes to the Date Methods

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

JavaScript 1.3 adds optional parameters to a number of Date methods:


setMonth(<months>[, <date>])
setHourse(<hours>[, <minutes>[, <seconds>[, <milliseconds>]]])
setMinutes(<minutes>[, <seconds>[, <milliseconds>]])
setSeconds(<seconds>[, <milliseconds>])

These methods are similar to the equivalent setUTC* methods described in the previous page. The only difference is that the setUTC* methods set the date information according to the Universal Coordinate Time, while these methods set the date information according to local time. As with the setUTC* methods, if you do not specify these optional parameters, the appropriate get* methods are used: getDate(), getMinute(), getSeconds(), and getMilliseconds().

As explained in the previous page, if the number specified for any of the parameters is outside its expected range, the Date object is being updated accordingly. For example, if we set <date> to 45 for the month of June, then the month stored in the Date object is incremented to July, and <date> is set to 15.

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: September 14, 1998
Revised: September 14, 1998

URL: http://www.webreference.com/js/column25/datechg.html