QTP的那些事---时间格式转换函数
2011-12-31 17:15
127 查看
*******************************************************************************************
'功能:时间字符串格式转换
'参数:str代表时间字符串,formatdata代表需要截取的字符
'返回值:获取你所需指定的单元格的值
'作者:
'*******************************************************************************************
FunctiondateFormat(str,formatdata)
t=Split(str,formatdata,-1,1)
newstr=join(t,"")
dateFormat=newstr
Endfunction
'时间格式转换
FunctionFormateDateTime(sendTime,Para)
selectcasePara
RemYYYYMMDDHHmmss
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)
RemYYYYMMDD
case"2"
sendTime=year(sendTime)&right("00"&month(sendTime),2)&right("00"&day(sendTime),2)
RemYYYY-MM-DD
case"3"
sendTime=year(sendTime)&"-"&right("00"&month(sendTime),2)&"-"&right("00"&day(sendTime),2)
RemYYYY年MM月DD日
case"4"
sendTime=year(sendTime)&"年"&right("00"&month(sendTime),2)&"月"&right("00"&day(sendTime),2)&"日"
RemYYYY-MM-DDHH: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)
endselect
FormateDateTime=SendTime
endFunction
相关文章推荐
- QTP的那些事--QTP回放iFrame控件时间非常慢的问题分析
- QTP的那些事--项目实践操作案例代码--查询操作
- QTP的那些事--ajax中的autocomplete的最终几种解决方案
- QTP的那些事--采用DOM,描述性编程获取指定的对象
- QTP的那些事--进入后菜单栏消失的解决方法
- QTP的那些事--WebList与正则表达式
- QTP的那些事--共享对象库的使用
- MySQL时间格式转换函数date_format()用法详解
- java api名人的故事(一):时间api的那些事
- [从头读历史] 第298节 时间简史 关于黑洞的那些事
- 网络时间的那些事及 ntpq 详解
- QTP的那些事--DOM和childItem(row,column,micclass,index)
- QTP的那些事--退出QTP的当前运行
- QTP获取当前系统时间
- QTP中与时间同步点:Sync、Wait、Waitproperty、Exist
- 设置QTP脚本中每个步骤之间的延时时间
- QTP的那些事--二进制和字符串的相互转换
- MySQL时间格式转换函数date_format()用法详解
- QTP的那些事--操作excel的函数
- QTP的那些事---右键点击对象的方法--DeviceReplay