formatdate()
'////////////////////////////////////////////////////////////////////////////////////////////
'功能:用来格式化日期时间的样式
'返回值:被格式化后的日期时间样式
'说明: DateStr获取的时间;
' Types时间的显示形势;如果是0那么将不显示时间
' IntType如果时分秒只有一位数字是否需要用零来补充,如果是1就需要补充
'作者:Seven
'来自:www.7di.net
'时间:2006-3-11
'////////////////////////////////////////////////////////////////////////////////////////////
Function DateFormat(DateStr,Types,IntType)
Dim strYear,strMonth,strDay,strHour,strMinute
Dim DateString
if IsDate(DateStr) = False then
DateString = ""
end if
If IntType=1 then
strYear=Year(DateStr)
strMonth=Month(DateStr)
If len(strMonth)=1 then strMonth="0"&strMonth
strDay=Day(DateStr)
If len(strDay)=1 then strDay="0"&strDay
strHour=Hour(DateStr)
If len(strHour)=1 then strHour="0"&strHour
strMinute=Minute(DateStr)
If len(strMinute)=1 then strMinute="0"&strMinute
Else
strYear=Year(DateStr)
strMonth=Month(DateStr)
strDay=Day(DateStr)
strHour=Hour(DateStr)
strMinute=Minute(DateStr)
End if
Select Case Types
Case "0"
DateString = ""
Case "1"
DateString = strMonth&"-"&strDay
Case "2"
DateString = strMonth&"/"&strDay
Case "3"
DateString = strMonth&"."&strDay
Case "4"
DateString = strHour&":"&strMinute
Case "5"
| 论坛热门帖子: | [lch203] 写得蛮好的linux学习笔记(10-21) [黑马制造] 学习java的30个目标(10-19) [笑傲股林] 做测试半年了,有点迷茫,应该再学些什么提高自己的测试水平和测试能力呢?(10-19) [udp8589] 大家用google的来吱一声? 用百度的~~也来报道下?(10-18) [沂偌掳兆] 本人总结的一些认为C++比较经典的书籍,希望对大家有用(10-18) |
| TAG标签: | 问题 解答 格式 返回 函数 DateString Case DateStr then |
注册
个人空间
