詳解JavaScript中setSeconds()方法的使用
javascript Date.setSeconds()方法按照本地時(shí)間的設(shè)置秒指定日期。
語法
Date.setSeconds(secondsValue[, msValue])
注:括號(hào)內(nèi)外的數(shù)據(jù)是可選的
下面是參數(shù)的詳細(xì)信息:
- secondsValue : 0到59之間的整數(shù)。
- msValue : 一個(gè)數(shù)字在0和999之間,表示毫秒。
如果不指定msValue參數(shù),使用從方法使用getMilliseconds返回的值。如果指定的參數(shù)是預(yù)期范圍之外,調(diào)用setSeconds嘗試相應(yīng)地更新Date對(duì)象的最新信息。例如,如果使用secondsValue的值為100,存儲(chǔ)在日期對(duì)象的分鐘將加1,40將用于秒。
返回值:
- NA
例子:
<html> <head> <title>JavaScript setSeconds Method</title> </head> <body> <script type="text/javascript"> var dt = new Date( "Aug 28, 2008 23:30:00" ); dt.setSeconds( 80 ); document.write( dt ); </script> </body> </html>
這將產(chǎn)生以下結(jié)果:
Thu Aug 28 23:31:20 UTC+0530 2008
相關(guān)文章
簡(jiǎn)介JavaScript中的italics()方法的使用
這篇文章主要介紹了JavaScript中的italics()方法使用,是JS入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下2015-06-06
javascript document.execCommand() 常用解析
dom下execCommand命令的一些參數(shù)整理,需要的朋友可以參考下。2009-12-12
javascript中實(shí)現(xiàn)兼容JAVA的hashCode算法代碼分享
這篇文章主要介紹了javascript中實(shí)現(xiàn)兼容JAVA的hashCode算法代碼分享,實(shí)現(xiàn)跟JAVA中的運(yùn)算結(jié)果一致,需要的朋友可以參考下2014-08-08
關(guān)于eval 與new Function 到底該選哪個(gè)?
本篇文章小編將為大家介紹,關(guān)于eval 與new Function 到底該選哪個(gè)?有需要的朋友可以參考一下2013-04-04

