Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) Private Type SYSTEMTIME wYear As Integer '年 wMonth As Integer '月 wDayOfWeek As Integer '星期,1-星期日;2-星期一;3:星期二…… wDay As Integer '日 wHour As Integer '时 wMinute As Integer '分 wSecond As Integer '秒 wMilliseconds As Integer '微秒 End Type Private Sub Form_Load() Dim MyTime As SYSTEMTIME GetLocalTime MyTime Debug.Print "当前时间之分钟:", MyTime.wMinute End Sub
Minute("2005-08-12 12:33:00") '取得分钟:33
Hour、Minute、Second函数取时分秒
Print DatePart("n", Time)===============================
-= www.PoP4u.net =-
我这里还有一种办法
问:要取的是当前的时间中的分钟怎么取?
答:Print Format(Date, "YYYY") '年
Print Format(Date, "MM") '月
Print Format(Date, "DD") '日
Print Format(Time, "HH") '时
Print Format(Time, "NN") '分
Print Format(Time, "SS") '秒
Print Format(Date, "WW") '周次
Print Format(Date, "Q") '季度
Print Format(Date, "DDDD") '星期
Debug.Print Format(Time, "NN")
Private Type SYSTEMTIME
wYear As Integer '年
wMonth As Integer '月
wDayOfWeek As Integer '星期,1-星期日;2-星期一;3:星期二……
wDay As Integer '日
wHour As Integer '时
wMinute As Integer '分
wSecond As Integer '秒
wMilliseconds As Integer '微秒
End Type
Private Sub Form_Load()
Dim MyTime As SYSTEMTIME
GetLocalTime MyTime
Debug.Print "当前时间之分钟:", MyTime.wMinute
End Sub
我这里还有一种办法
问:要取的是当前的时间中的分钟怎么取?
答:Print Format(Date, "YYYY") '年
Print Format(Date, "MM") '月
Print Format(Date, "DD") '日
Print Format(Time, "HH") '时
Print Format(Time, "NN") '分
Print Format(Time, "SS") '秒
Print Format(Date, "WW") '周次
Print Format(Date, "Q") '季度
Print Format(Date, "DDDD") '星期
===========================================
呵呵,你干脆指出人来好了。说话就不能文明点?你是来这干吗的?做小混混?
问题的确是个小问题,但是知道就是知道,不知道就是不知道,干嘛在这儿误导别人。