var date = new Date();
var d = "";
var t = date.getFullYear() + "年" + (date.getMonth() + 1) + "月" + date.getDate() + "日" + date.getHours() + "时" + date.getMinutes() + "分";//date.getSeconds() + "秒"
var nowtime = date.getHours() + "时" + date.getMinutes() + "分";
if (date.getHours() < 8) {
d = "早晨";
} else if (date.getHours() < 12) {
d = "上午";
} else if (date.getHours() < 18) {
d = "下午";
} else {
d = "晚上";
}
本文介绍了一种使用JavaScript处理日期时间的方法,并根据当前时间显示不同的问候语。通过获取年、月、日、时、分等信息,实现了动态的时间展示及个性化问候功能。
4447

被折叠的 条评论
为什么被折叠?



