JavaScript tutorial:
getUTCSeconds method

 

Applies to: Date Object

Returns the seconds value in a Date object using Universal Coordinated Time (UTC).

Syntax

objDate.getUTCSeconds()

Return

Returns the seconds value in a Date object using UTC.

Example

To get the number of seconds in local time, use the getSeconds method.

The getUTCSeconds method returns an integer between 0 and 59 indicating the seconds value of the indicated Date object. A zero occurs in two situations: the time is less than one second into the current minute, or a time was not stored in the Date object when the object was created. The only way to determine which situation you have is to also check the minutes and hours for zero values. If they are all zeroes, it is nearly certain that the time was not stored in the Date object.

The following example illustrates the use of the getUTCSeconds method:

s = "Current Universal Coordinated Time (UTC) is: "; = ":";
d = new Date();
s += d.getUTCHours() + c;
s += d.getUTCMinutes() + c;
s += d.getUTCSeconds() + c;
s += d.getUTCMilliseconds();

document.write(s);

  To run the code above, paste it into JavaScript Editor, and click the Execute button

See also: Date Object Methods, getSeconds Method, setSeconds Method, setUTCSeconds Method

 

Home  |  About C-Point  |   Awards  |  Purchase  |  Contact Us
C Point
Antechinus® Creative Software: http://www.c-point.com
Net Marketing Insider: http://www.NetMarketingInsider.com
 
Copyright © 1998- C Point Pty Ltd. All Rights Reserved
Privacy Policy | Acceptable Use Policy (AUP)
 
71 Williamson Road, Para Hills 5096, Australia
Tel: +618 8263 3623 Fax: +618 8396 1477