JavaScript入門講座

Home > Dateオブジェクト > setMillisecondsメソッド

setMillisecondsメソッド

setMillisecondsメソッドはローカルのミリ秒(0~999)を設定します。

書式setMilliseconds(ミリ秒)
戻り値-
引数ミリ秒ミリ秒(0~999)を設定する
使用例ミリ秒を設定する。

var dt = new Date();

document.write("設定前:",dt.getMilliseconds(),"ミリ秒",'<br />');

//555ミリ秒を設定する
dt.setMilliseconds(555);

document.write("設定後:",dt.getMilliseconds(),"ミリ秒");
							
関連メンバ説明
setFullYear年を設定(4桁)
setMonth月を設定(0~11)
setDate日を設定(1~31)
setHours時を設定(0~23)
setMinutes分を設定(0~59)
setSeconds秒を設定(0~59)
setTimeミリ秒単位で日付と時間を設定