*******************************************************************************************
'功能:时间字符串格式转换
'参数:str代表时间字符串,formatdata代表需要截取的字符
'返回值:获取你所需指定的单元格的值
'作者:
'*******************************************************************************************
Function dateFormat(str,formatdata)
t=Split(str,formatdata,-1,1)
newstr=join(t,"")
dateFormat=newstr
End function
'时间格式转换
Function FormateDateTime(sendTime,Para)
select case Para
Rem YYYYMMDDHHmmss
case "1 "
sendTime = year(sendTime) & right( "00 " & month(sendTime),2) & right( "00 " & day(sendTime),2) & right( "00 " & hour(sendTime),2) & right( "00 " & minute(sendTime),2) & right( "00 " & second(sendTime),2)
Rem YYYYMMDD
case "2 "
sendTime = year(sendTime) & right( "00 " & month(sendTime),2) & right( "00 " & day(sendTime),2)
Rem YYYY-MM-DD
case "3 "
sendTime = year(sendTime) & "- "& right( "00 " & month(sendTime),2) & "- "& right( "00 " & day(sendTime),2)
Rem YYYY年MM月DD日
case "4 "
sendTime = year(sendTime) & "年 "& right( "00 " & month(sendTime),2) & "月 "& right( "00 " & day(sendTime),2)& "日 "
Rem YYYY-MM-DD HH:mm:ss
case "5 "
sendTime = year(sendTime) & "- "& right( "00 " & month(sendTime),2) & "- "& right( "00 " & day(sendTime),2) & " "& right( "00 " & hour(sendTime),2) & ": "& right( "00 " & minute(sendTime),2) & ": "& right( "00 " & second(sendTime),2)
end select
FormateDateTime = SendTime
end Function