其實 難度很大呀。既要考慮閏年,又要考慮,閏年的的 2 月
   利用 days=data mod 86400 + 1 得到 當前相對 是 1990 1 1 0時的第days=data/86400+1 天。
   在設計一個算法 計算 1990 年有多少天,92,93.。。
   用 days 依次 減 1990,91,92。﹝。年的天數 直到 差<=0。等於 0 表示,現在是你最後的減數的年份 xx/12/31 24時 或者 xx+1/1/1 0時。小於 0  表示,現在是你最後的減數的年份 xx/1/1 0時 ---xx/12/31 24時之間的某個時間,在用上面類似的方法,計數是哪個月,那天,最後剩下的,是 幾 時,data/86400 的余數 算出 當前分鐘,最後剩下的 是 當前 的 秒

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim days As Long
    Dim seconds As Long
    days = Text1.Text \ 86400 + 1
    seconds = Text1.Text Mod 86400'year 1990 .365
    dayyear = 365
    Dim years As Integer
     years = 0
    Do While (days > dayyear)
        years = years + 1
        days = days - dayyear
        dayyear = year_days(1990 + years)
    Loop'month 1 ,31
    Dim daymonth As Integer
    Dim months As Integer
       daymonth = 31
       months = 1
    Do While (days > daymonth)
        months = months + 1
        days = days - daymonth
        daymonth = month_Days(months, 1990 + years)
    LoopText2.Text = Str(1990 + years) & "/" & Str(months) & "/" & Str(days)
    Text3.Text = seconds
    Text4.Text = 1990 + years
    Text5.Text = months
    Text6.Text = days
    End SubFunction year_days(ByVal year As Integer) As Long
        Dim year_before As String
        Dim year_after As String
        year_before = Str(year - 1) & "/01/01"
        year_after = Str(year) & "/01/01"
        year_days = DateDiff("d", year_before, year_after)
    End FunctionFunction month_Days(ByVal month As Integer, ByVal year As Integer) As Integer
    Select Case month
    Case 1, 3, 5, 7, 8, 10, 12
       month_Days = 31
    Case 2
       If year Mod 4 = 0 And year Mod 100 = 0 And year Mod 400 <> 0 Then
            month_Days = 29
          Else
            month_Days = 28
       End If
    Case 4, 5, 9, 11
       month_Days = 30
    End Select
    End Function你試試 看看可以麼,小時,和秒 都類似。我不知道精確麼,不精確,你可以參考麼