ホームページ  >  記事  >  ウェブフロントエンド  >  指定された形式で日付と時刻を表示する js スタイルのコード_javascript スキル

指定された形式で日付と時刻を表示する js スタイルのコード_javascript スキル

WBOY
WBOYオリジナル
2016-05-16 17:37:18984ブラウズ

[Ctrl A すべて選択 注: 外部 Js を導入する必要がある場合は、更新して実行する必要があります
]

time は現在の時刻です コードは次のとおりです:


//1.2013- 4-9 11:21:32
//2. April 9, 2013 11:21:32
//3. April 9, 2013 11:21:32 am
//4. April 9 、2013 13:21:32 pm Seconds
/*
var thedate = new Date();
alert(thedate.getFull Year() '-' thedate.getMonth() '-' thedate.getDate( ) ' ' thedate.toLocaleTimeString() );
alert(thedate.toLocaleDateString() ' ' thedate.getHours() 'point' thedate.getMinutes() '分' thedate.getSeconds() '秒'); >if (thedate.getHours() < 12) {
alert(thedate.toLocaleDateString() '午前' thedate.getHours() 'ポイント' thedate.getMinutes() '分' thedate.getSeconds() '秒' );
}
else {
alert(thedate.toLocaleDateString() '午後' thedate.getHours() 'point' thedate.getMinutes() '分' thedate.getSeconds() '秒');
}
* /
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。