我发现最近在创建必须由ftp上传的文件时需要此文件。 文件扩展名是hhnnssms的时间戳,ms部分被格式化为4位数字。 由于Now()函数不会返回毫秒,因此我使用以下函数进行计算。
Option Compare Database
Option Explicit
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Sub GetSystemTime Lib "kernel32" _
(lpSystemTime As SYSTEMTIME)
Public Function TimeToMillisecond() As String
Dim tSystem As SYSTEMTIME
Dim sRet
On Error Resume Next
GetSystemTime tSystem
sRet = Hour(Now) & Minute(Now) & Second(Now) & Format(tSystem.wMilliseconds, "0000")
TimeToMillisecond = sRet
End Function
和往常一样,所有建议,批评和增强功能都可以欢迎:)
玛丽
From: https://bytes.com/topic/access/insights/876984-format-system-time-milliseconds-vba