home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Table 19.10 shows some of the methods of the Date object.

Table 19.10 HTML Date Object Methods

Property What It Does

getYear() returns the year
getMonth() returns the month
getDate() returns the day of the month
getDay() returns the day of the week
getHours() returns the hours
getMinutes() returns the minutes
getSeconds() returns the seconds
getTime() returns the number of milliseconds since January 1970 00:00:00
getTimezoneOffset() returns the number of hours of time zone offset from GMT in the current location
setYear(arg) sets the year to arg
setMonth(arg) sets the month to arg
setDate(arg) sets the day of the month to arg
setHours(arg) sets the hours to arg
setMinutes(arg) sets the minutes to arg
setSeconds(arg) sets the seconds to arg
setTime(arg) sets the number of milliseconds since January 1970 00:00:00 to arg
toGMTString() returns a string representation of the date in GMT
toLocalString() returns a string representation of the date in the local time zone

Using the Math Object

JavaScript’s Math object gives you access to various mathematical constants and functions. These are represented as properties and methods of the Math object. Table 19.11 shows the properties.

Table 19.11 HTML Math Object Properties

Property What It Does

E returns the constant e
LN2 returns the natural logarithm of 2
LN10 returns the natural logarithm of 10
LOG2E returns the base-10 logarithm of e
LOG10E returns the base-2 logarithm of e
PI returns the constant pi
SQRT1_2 returns the square root of 1/2
SQRT2 returns the square root of 2

Table 19.12 shows the Math object methods, which are the different functions that you can use.

Table 19.12 HTML Math Object Methods

Method What It Does

abs(x) absolute value of x
acos(x) arc cosine of x
asin(x) arc sine of x
atan(x) arc tangent of x
atan2(x,y) arc tangent of x,y
ceil(x) x rounded up to the nearest integer
cos(x) cosine of x
exp(x) e raised to the x power
floor(x) x rounded down to the nearest integer
log(x) logarithm of x
max(x,y) maximum of x and y
min(x,y) minimum of x and y
pow(x,y) x raised to the y power
random() returns a random number
round(x) x rounded to the nearest integer
sin(x) sine of x
sqrt(x) square root of x
tan(x) tangent of x


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.