JS 输出当前时间
2013-04-09 19:30
295 查看
//1.2013-4-9 11:21:32
//2.2013年4月9日 11点21分32秒
//3.2013年4月9日 上午11点21分32秒
//4.2013年4月9日 下午13点21分32秒
var thedate = new Date();
alert(thedate.getFullYear() + '-' + thedate.getMonth() + '-' + thedate.getDate() + ' ' + thedate.toLocaleTimeString());
alert(thedate.toLocaleDateString() + ' ' + thedate.getHours() + '点' + thedate.getMinutes() + '分' + thedate.getSeconds() + '秒');
if (thedate.getHours() < 12) {
alert(thedate.toLocaleDateString() + ' 上午' + thedate.getHours() + '点' + thedate.getMinutes() + '分' + thedate.getSeconds() + '秒');
}
else {
alert(thedate.toLocaleDateString() + ' 下午' + thedate.getHours() + '点' + thedate.getMinutes() + '分' + thedate.getSeconds() + '秒');
}
相关文章推荐
- js 输出当前时间 (即时变化…
- js 获取当前时间输出并刷新date
- js显示当前的时间直接输出到页面
- JS获取系统当前时间并格式化输出小函数
- js输出当前系统时间
- js输出当前时间到指定位置
- 【日常沉淀】实时输出当前时间的js
- js将当前时间日期格式化输出
- JS输出当前时间,且每秒变化
- js 获取当前的时间
- Js获取当前日期时间
- JS获取当前日期时间
- js当前时间格式化
- js获得url中的参数,获取当前时间
- 用js获取当前的时间包括年、月、日、时、分、秒
- js 中获取当前时间
- C语言实现不同时区的当前时间输出
- JS定时程序,设定一个一直刷新,又时间间隔的js,读取当前的时间并显示
- Js获取当前日期时间及其它操作
- js获取当前时间