VB 格式化输入毫秒
答案:4 悬赏:60 手机版
解决时间 2021-11-25 14:16
- 提问者网友:我是女神我骄傲
- 2021-11-25 01:09
VB 格式化输入毫秒
最佳答案
- 五星知识达人网友:不甚了了
- 2021-11-25 02:03
Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)
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 Function GetNowTime() As String
Dim SysTime As SYSTEMTIME
GetSystemTime SysTime
GetNowTime = SysTime.wMonth & "-" & SysTime.wDay & "-" & SysTime.wYear
GetNowTime = GetNowTime & SysTime.wHour & ":" & SysTime.wMinute & ":" & SysTime.wSecond & ":" & SysTime.wMilliseconds
End Function
Private Sub Command1_Click()
Print GetNowTime
End Sub
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 Function GetNowTime() As String
Dim SysTime As SYSTEMTIME
GetSystemTime SysTime
GetNowTime = SysTime.wMonth & "-" & SysTime.wDay & "-" & SysTime.wYear
GetNowTime = GetNowTime & SysTime.wHour & ":" & SysTime.wMinute & ":" & SysTime.wSecond & ":" & SysTime.wMilliseconds
End Function
Private Sub Command1_Click()
Print GetNowTime
End Sub
全部回答
- 1楼网友:逃夭
- 2021-11-25 03:28
毫秒输出来你也看不到.
- 2楼网友:平生事
- 2021-11-25 03:08
无其它更简洁的方式。
- 3楼网友:罪歌
- 2021-11-25 02:49
format是肯定不能带毫秒滴。要实现你的效果,也简单
Format(time,"YYYY-MM-DD HH:MM:SS") & "." & ( timer()*1000 mod 1000)
Format(time,"YYYY-MM-DD HH:MM:SS") 加上 . 再加上毫秒数,就构成了
timer()代表的是,从午夜到现在,所经过的秒数,它的小数部分x1000就是毫秒
Format(time,"YYYY-MM-DD HH:MM:SS") & "." & ( timer()*1000 mod 1000)
Format(time,"YYYY-MM-DD HH:MM:SS") 加上 . 再加上毫秒数,就构成了
timer()代表的是,从午夜到现在,所经过的秒数,它的小数部分x1000就是毫秒
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯