输出日期为输入日期的第二天,如果是月末则输出日期=输入日期,另对外输出格式化。 '**************************** '日期格式转换' '作者:刘相涛 '入参:待处理日期yyyymmdd;待处理日dd '返回:转换后日期yyyy-mm-dd '*************************** Function Datatransfer(KJDate As String, LastDate As String) As String 'Dim Datatransfer As String '日期转换,分别针对31天、30天、28天的月份,如果支付日期为月末最后一天,则T+0,否则T+1 Select Case LastDate '一三五七八十腊 31天 Case "01", "03", "05", "07", "08", "10", "12" If Right(KJDate, 2) <> "31" Then Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) + 1 Else Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) End If '四六九冬 30天 Case "04", "06", "09", "11" If Right(KJDate, 2) <> "30" Then Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) + 1 Else Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) End If '只有二月28天 Case "02" If Right(KJDate, 2) <> "28" Then Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) + 1 Else Datatransfer = Left(KJDate, 4) & "/" & Mid(KJDate, 5, 2) & "/" & CInt(Right(KJDate, 2)) End If Case Else ' End Select End Function
©️公众号:思考者文刀
- 上一篇: VBA:考勤数据统计
- 下一篇: Hadoop之HBase&Hive
评论