- 作者:zhaozj
- 发表时间:2020-12-23 11:03
- 来源:未知
%REM @author:snowdot23
@time:2004-1-10 @description: 和lotusscript操作word文件 有关的类; 格式化日期类型 %END REM
Class wordDate dateString As String starts As String stops As String Sub new( s As String) dateString=s Call splitString() End Sub Public Function getFormatDate(st As String) std= formatString(st) std= formatString1(st) getFormateDate=std End Function Public Function getStartDate() starts= formatString(starts) getStartDate=starts End Function Public Function getStopDate() stops=formatString(stops) getStopDate=stops End Function Private Sub splitString() Dim ins As Integer ins =Instr(datestring,"~") If ins>0 Then starts=Left(datestring,ins-1) stops=Right(datestring,Len(datestring)-ins) starts= formatString(starts) stops=formatString(stops) Else starts= formatString(starts) starts= formatString1(starts) End If End Sub Function formatString(st As String) formatString=Replace(st,"/","-") End Function Function formatString1(st As String) formatString1=Replace(st,".","-") End Function Function getyear( st As String) getyear=Left(st,4) End Function Function getMonth( st As String) Dim res As String Dim temp As String temp=Right(st,Len(st)-4) Dim temp1 As String temp1=Left(temp,1) If temp1="/" Or temp1="." Then temp1=Right(temp,Len(st)-5) res=Left(temp1,2) Else res=Left(temp,2) End If getMonth=temp1 End Function Function getday( st As String) getday=Right(st,2) End FunctionEnd Class