⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datediff.frm

📁 计算两天之间有多少天
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1215
   ClientLeft      =   3285
   ClientTop       =   2925
   ClientWidth     =   1800
   LinkTopic       =   "Form1"
   ScaleHeight     =   1215
   ScaleWidth      =   1800
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Height          =   735
      Left            =   120
      TabIndex        =   1
      Top             =   0
      Width           =   1575
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   840
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()

    'Tony Jones, Queensland, Australia
    'Email: tvtech@homemail.com
    
    'Southern Cross Visual Basic Code and Links
    'http:www.geocities.com/~scvb/index.html
    
    'Displays the differene between two dates
    '11-11-97 to 01-01-01 (Next century!)
    'Returns: Days formatted with ',' delimiter, as used
    'in Southern Hemisphere ie Australia, New Zealand
        
    Label2 = "The difference between 11-11-97 to 01-01-01 is:"
    Label1 = Format$(days360("11-11-97", "01-01-01"), "###,###") & " days"

End Sub
Public Function days360(dt1 As Date, dt2 As Date) As Long
    
    Dim z1 As Long, z2 As Long
    Dim d1 As Long, d2 As Long
    Dim m1 As Long, m2 As Long
    Dim y1 As Long, y2 As Long
    
    d1 = Day(dt1)
    m1 = Month(dt1)
    y1 = Year(dt1)
    
    d2 = Day(dt2)
    m2 = Month(dt2)
    y2 = Year(dt2)
    
    If d1 = 31 Then
        z1 = 30
    Else
        z1 = d1
    End If
    
    If d2 = 31 And d1 >= 30 Then
        z2 = 30
    Else
        z2 = d2
    End If

    days360 = (y2 - y1) * 360 + (m2 - m1) * 30 + (z2 - z1)

End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -