Get the UTC date's seconds as a number between 0 and 59 in JavaScript

Description

The following code shows how to get the UTC date's seconds as a number between 0 and 59.

Example


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var aDate = new Date(2012, 4, 5, 17, 55, 55);
document.writeln(aDate.getUTCSeconds());
<!--from  w ww  .j  a v a2  s  . co  m-->
</script>
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Get the UTC date
Home »
  Javascript Tutorial »
    Data Type »
      Date
...
Convert Date to String showing the date's h...
Convert date to the milliseconds representa...
Convert date value to local format string i...
Create Date object from year month hour min...
Create Date value from String in the format...
Create Date value from String in the format...
Create Date value from milliseconds in Java...
Create Date value from string in the format...
Create Date value from string in the format...
Create date in Coordinated Universal Time i...
Display current time by using Date.getHours...
Format Time to have two digit for each fiel...
Get current date and time in JavaScript
Get current time in the millisecond with Da...
Get the UTC date's day of the week as a num...
Get the UTC date's hours as a number betwee...
Get the UTC date's milliseconds in JavaScri...
Get the UTC date's minutes as a number betw...
Get the UTC date's seconds as a number betw...
Get the date's day of the week as a number ...
Get the date's hours as a number between 0 ...
Get the date's milliseconds in JavaScript
Get the date's minutes as a number between ...
Get the date's seconds as a number between ...
Get the day of the month (1 through 31) for...
Get the day of the month (1 through 31) for...
Get the four-digit year (2007 instead of ju...
Get the four-digit year of the UTC date val...
Get the milliseconds representation of the ...
Get the month name for UTC time in JavaScri...
Get the month of the UTC date, where 0 repr...
Get the month of the date, where 0 represen...
Get the number of minutes that the local ti...
Get year, month and day from date differenc...
Parse an invalid date in JavaScript
Pass a string date value in format of "ISO ...
Parse a string date value in format of "day...
Pass a string date value in format of "mont...
...