使用 excel vba 函数的当前时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11684888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 13:39:39  来源:igfitidea点击:

Day current time for function using excel vba

excelexcel-vbadatetimetimevba

提问by Devendar

searched on Google I found one. Is it possible to format time in [h]:mm format using VBA?

在谷歌上搜索我找到了一个。是否可以使用 VBA 以 [h]:mm 格式格式化时间?

Dim currentTime As Date
currentTime = TimeOfDay

I passed currentTimeinto database when I dumped data - showing put put as 00.00.00.000000not understood why its showing different? Is there any other function to call current time 00.00 AM/PM

currentTime在转储数据时传入了数据库 - 显示 put put00.00.00.000000不明白为什么它显示不同?有没有其他函数可以调用当前时间00.00 AM/PM

回答by brettdj

To format the current time to your specs try

要将当前时间格式化为您的规格,请尝试

MsgBox Format(Now(), "hh:mm AMPM")