使用excel vba的函数当前时间

时间:2022-09-02 08:57:24

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 currentTime into database when I dumped data - showing put put as 00.00.00.000000 not understood why its showing different? Is there any other function to call current time 00.00 AM/PM

当我转储数据时,我将currentTime传递给了数据库——显示put为00.00.00.00.00.000000不明白为什么它的显示会不一样?还有其他功能可以调用当前时间:上午10点/下午10点吗

1 个解决方案

#1


7  

To format the current time to your specs try

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

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

#1


7  

To format the current time to your specs try

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

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