Javascript 将时间转换为00d 00h 00m
我希望它能以这种方式显示时间:Javascript 将时间转换为00d 00h 00m,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,我希望它能以这种方式显示时间:00d00h但我不知道它怎么能显示一天24小时而不是总小时 显示内容:10d170h 我想要的:10d08h Math.floor((Date.now()-member.user.createdAt)/86400000)}d${Math.floor((Date.now()-member.user.createdAt)/60*60*24*1000)}h您可以将小时总数修改为24,这意味着每24小时它将“旋转”回0 console.log(数学地板((Date.now(
00d00h
但我不知道它怎么能显示一天24小时而不是总小时
显示内容:10d170h
我想要的:10d08h
Math.floor((Date.now()-member.user.createdAt)/86400000)}d${Math.floor((Date.now()-member.user.createdAt)/60*60*24*1000)}h
您可以将小时总数修改为24,这意味着每24小时它将“旋转”回0
console.log(数学地板((Date.now())/86400000)+“d”+数学地板((Date.now())/(60*60*24*1000)%24)+“h”)代码>我猜你的意思是10d08h
@programmandoconro是的,错了