本文介绍了将秒转换为年、天、小时、分钟、秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多东西可以将秒转换为小时、分钟和秒.
I have this much to convert seconds to hours, minutes, and seconds.
我需要让它工作多年,甚至几天.
I need to make it work for years, and days too.
有人可以帮忙吗?
Dim mHours As Long, mMinutes As Long, mSeconds As Long
mSeconds = 12345 ' Sample data
mHours = mSeconds \ 3600
mMinutes = (mSeconds - (mHours * 3600)) \ 60
mSeconds = mSeconds - ((mHours * 3600) + (mMinutes * 60))
MsgBox mHours & ":" & mMinutes & ":" & mSeconds
推荐答案
Dim mHours As Long, mMinutes As Long, mSeconds As Long, mDays as Long, mYears as Long
mSeconds = 12345 ' Sample data
mHours = mSeconds / 3600
mMinutes = (mSeconds - (mHours * 3600)) / 60
mSeconds = mSeconds - ((mHours * 3600) + (mMinutes * 60))
MsgBox mHours & ":" & mMinutes & ":" & mSeconds
mDays = mSeconds / 86400
mYears = mSeconds / 31557600
我假设每年有 365.25 天
I am assuming each year has 365.25 days
这篇关于将秒转换为年、天、小时、分钟、秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!