将整数(秒)转换为时间格式(超过24小时) [英] Format Integer(Seconds) To Time Format(More Than 24 Hrs)

查看:512
本文介绍了将整数(秒)转换为时间格式(超过24小时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好团队,

我想在访问报告中以hh:nn:ss格式显示Seconds.
例如我有Seconds = 92730,现在我将其转换为(92730/86400),并在报告中将其格式化为hh:nn:ss.但这显示为01:45:30.我希望它是25:45:30.

在Excel中,格式为[h]:mm:ss,但是访问权限等效吗?

怎么做???

Hello Team,

I want to display Seconds as hh:nn:ss format in access report.
e.g. I have Seconds=92730, now I converted it as (92730/86400) and formated it in hh:nn:ss in report. But this displayed as 01:45:30. I want it as 25:45:30.

In Excel we have format as [h]:mm:ss but what is equavalent in access??

How to do this???
Please help me!!!

推荐答案

您无法使用Format()函数,因为它使用24小时格式.
您需要编写自定义函数,如下所示:
You can''t do it using Format() function, becouse it use 24 hours format.
You need to write custom function, like this:
Function MyFormat(countOfSeconds As Long) As String
Dim h As Long, n As Long, s As Long

h = Fix(countOfSeconds / 3600) 'hours
n = Fix((countOfSeconds Mod 3600) / 60) 'minutes
s = countOfSeconds - ((h * 3600) + (n * 60)) 'seconds

MyFormat = h & ":" & n & ":" & s & ":"

End Function


这篇关于将整数(秒)转换为时间格式(超过24小时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆