ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

vb ¦p¦ó±N107¦~01¤ë16¤é¦¹ºØ¤å¦r®æ¦¡Âà´«¬°¤é´Á®æ¦¡ ?

vb ¦p¦ó±N107¦~01¤ë16¤é¦¹ºØ¤å¦r®æ¦¡Âà´«¬°¤é´Á®æ¦¡ ?

vb ¦p¦ó±N107¦~01¤ë16¤é¦¹ºØ¤å¦r®æ¦¡Âà´«¬°¤é´Á®æ¦¡ ?
¥Øªº==>§PÂ_¤é´Áªº¤j¤p

¦^´_ 1# t8899
  1. Sub ex()
  2. dstr = "107¦~01¤ë16¤é"
  3. d = Replace(Replace(Replace(dstr, "¦~", "/"), "¤ë", "/"), "¤é", "")
  4. a = Split(d, "/")
  5. a(0) = a(0) + 1911
  6. MsgBox Join(a, "/")
  7. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_  t8899
Hsieh µoªí©ó 2018-1-17 09:21


©êºp¡A107¦~01¤ë16¤é ¬OÅÜ¼Æ ¹³ 108¦~02¤ë09¤é

TOP

¦^´_ 1# t8899
§Ú²q¥t¤@­Ó½×¾Â¸Ìªº¤]¬O§A§a¡Aºâ¤F³o¸Ì¦AÖ߶K¤@¦¸¡G
  1. Function MDate2Date(ByVal strDate As String, ByRef RefDate As Date) As Boolean
  2.   Dim MatChes As Object
  3.   Dim I  As Long, K As Long
  4.   Dim strTemp As String
  5.   Dim Date1 As Date
  6.   
  7.   On Error GoTo MDate1DateError
  8.   RefDate = Date1
  9.   Date1 = #1/1/1912#
  10.   With CreateObject("VBScript.RegExp")
  11.     .Global = True
  12.     .Pattern = "\d+[\\/¦~\-]\s*\b((0{0,1}[1-9])|(1[0-2]))[\\/\-¤ë]\s*\b((0{0,1}[1-9])|([12]\d)|(3[0-1]))(¤é|\b)"
  13.     Set MatChes = .Execute(strDate)
  14.     If MatChes.Count Then
  15.       strDate = MatChes.Item(0)
  16.     Else
  17.       Exit Function
  18.     End If
  19.     .Pattern = "\d+"
  20.     Set MatChes = .Execute(strDate)
  21.     For I = 1 To 3
  22.       K = Val(MatChes.Item(I - 1))
  23.       Date1 = DateAdd(Choose(I, "yyyy", "m", "d"), K - 1, Date1)
  24.     Next I
  25.     MDate2Date = Day(Date1) = K
  26.     If MDate2Date Then RefDate = Date1
  27.   End With
  28. MDate1DateError:
  29. End Function
½Æ»s¥N½X
¥@¬É¨º»ò¤j¡A¥i§Ú·Q¥h­þ¡H

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD