js毫秒值转成年月日方法

<html>
	<head>
		<script>
			//这里传入的值一定要是数字,如果是字符串的话,需要先转为int型
			//出生日期
 			var time = new Date(1322195034000);
			
			 console.log(time.getFullYear()+"年");//年份
			console.log(time.getMonth()+1+"月");//月份
			console.log(time.getDate()+"日");//几号 
			var birthday= time.getFullYear()+"年"+time.getMonth()+1+"月"+time.getDate()+"日";
		</script>
	</head>
</html>

猜你喜欢

转载自blog.csdn.net/adminBfl/article/details/83026472
今日推荐