date()函数返回格式

'  
  '功能:用来格式化日期时间的样式  
  '返回值:被格式化后的日期时间样式  
  '说明:   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"  
      DateString   =   strMonth&"月"&strDay&"日"  
      Case   "6"  
      DateString   =   strDay&"日"&strHour&"时"  
      case   "7"  
      DateString   =   strDay&"日"&strHour&"点"  
      Case   "8"  
      DateString   =   strHour&"时"&strMinute&"分"  
      Case   "9"  
      DateString   =   strYear&"年"&strMonth&"月"&strDay&"日"  
      Case   "10"    
      DateString   =   strYear&"-"&strMonth&"-"&strDay  
      Case   "11"  
      DateString   =   strYear&"."&strMonth&"."&strDay  
      Case   "12"  
      DateString   =   strYear&"/"&strMonth&"/"&strDay  
      Case   "13"  
      DateString   =   strMonth&"/"&strDay&"/"&strYear  
      Case   "14"  
      DateString   =   strDay&"/"&strMonth&"/"&strYear  
      Case   "15"  
      DateString   =   strMonth&"-"&strDay&"-"&strYear  
      Case   "16"  
      DateString   =   strMonth&"."&strDay&"."&strYear  
    End   Select  
    DateFormat   =   DateString  
    End   Function

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值