您可以使用以下代码来使用FormatDateTime函数来格式化时间:
Dim currentTime As Date
currentTime = Now
Dim formattedTime As String
formattedTime = FormatDateTime(currentTime, vbLongTime)
MsgBox "当前时间为:" & formattedTime
这段代码将当前时间格式化为长时间格式,并显示在一个消息框中。您可以根据自己的需求选择不同的时间格式,例如vbShortTime表示短时间格式,vbLongDate表示长日期格式等。更多关于FormatDateTime函数的详细用法可以参考相关的文档或教程。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:php怎么格式化时间戳