dateObject.setUTCSeconds( secondsValue )メソッドは、Dateオブジェクトの協定世界時に基づく日時の何秒かを設定するメソッド。
構文
dateObject.setUTCSeconds( secondsValue )
引数
- secondsValue
- Dateオブジェクトの協定世界時に基づく日時の秒を、「0~59」の数値で指定する。
サンプル
<script type="text/javascript">
var $dateObject = new Date( "2013-05-03T13:25:30.500" );
document.write( $dateObject.getUTCFullYear() + '年' );
document.write( $dateObject.getUTCMonth()+1 + '月' );
document.write( $dateObject.getUTCDate() + '日' );
document.write( $dateObject.getUTCHours() + '時' );
document.write( $dateObject.getUTCMinutes() + '分' );
document.write( $dateObject.getUTCSeconds() + '秒' );
document.write( $dateObject.getUTCMilliseconds() + 'ミリ秒<br />' );
$dateObject.setUTCSeconds( 59 );
document.write( '「$dateObject.setUTCSeconds( 59 )」で何秒かを設定すると、<br />' );
document.write( $dateObject.getUTCFullYear() + '年' );
document.write( $dateObject.getUTCMonth()+1 + '月' );
document.write( $dateObject.getUTCDate() + '日' );
document.write( $dateObject.getUTCHours() + '時' );
document.write( $dateObject.getUTCMinutes() + '分' );
document.write( $dateObject.getUTCSeconds() + '秒' );
document.write( $dateObject.getUTCMilliseconds() + 'ミリ秒<br />' );
</script>
var $dateObject = new Date( "2013-05-03T13:25:30.500" );
document.write( $dateObject.getUTCFullYear() + '年' );
document.write( $dateObject.getUTCMonth()+1 + '月' );
document.write( $dateObject.getUTCDate() + '日' );
document.write( $dateObject.getUTCHours() + '時' );
document.write( $dateObject.getUTCMinutes() + '分' );
document.write( $dateObject.getUTCSeconds() + '秒' );
document.write( $dateObject.getUTCMilliseconds() + 'ミリ秒<br />' );
$dateObject.setUTCSeconds( 59 );
document.write( '「$dateObject.setUTCSeconds( 59 )」で何秒かを設定すると、<br />' );
document.write( $dateObject.getUTCFullYear() + '年' );
document.write( $dateObject.getUTCMonth()+1 + '月' );
document.write( $dateObject.getUTCDate() + '日' );
document.write( $dateObject.getUTCHours() + '時' );
document.write( $dateObject.getUTCMinutes() + '分' );
document.write( $dateObject.getUTCSeconds() + '秒' );
document.write( $dateObject.getUTCMilliseconds() + 'ミリ秒<br />' );
</script>
↓↓↓出力結果↓↓↓