home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmDate
- BackColor = &H00C0C0C0&
- Caption = "Date Demonstration"
- ClientHeight = 1245
- ClientLeft = 2490
- ClientTop = 2535
- ClientWidth = 4650
- Height = 1650
- Left = 2430
- LinkTopic = "Form1"
- ScaleHeight = 5.188
- ScaleMode = 4 'Character
- ScaleWidth = 38.75
- Top = 2190
- Width = 4770
- Begin Label lblFmtdate
- BorderStyle = 1 'Fixed Single
- Height = 240
- Left = 1440
- TabIndex = 3
- Top = 840
- Width = 3000
- End
- Begin Label lblCvtDate
- BorderStyle = 1 'Fixed Single
- Height = 240
- Left = 1440
- TabIndex = 4
- Top = 480
- Width = 3000
- End
- Begin Label lblSysDate
- BorderStyle = 1 'Fixed Single
- Height = 240
- Left = 1440
- TabIndex = 5
- Top = 120
- Width = 3000
- End
- Begin Label label
- Alignment = 1 'Right Justify
- BackStyle = 0 'Transparent
- Caption = "Days to Date:"
- Height = 240
- Index = 2
- Left = 180
- TabIndex = 2
- Top = 840
- Width = 1245
- End
- Begin Label label
- Alignment = 1 'Right Justify
- BackStyle = 0 'Transparent
- Caption = "Date to Days:"
- Height = 240
- Index = 1
- Left = 180
- TabIndex = 1
- Top = 480
- Width = 1245
- End
- Begin Label label
- Alignment = 1 'Right Justify
- BackStyle = 0 'Transparent
- Caption = "System Date:"
- Height = 240
- Index = 0
- Left = 180
- TabIndex = 0
- Top = 120
- Width = 1245
- End
- Option Explicit
- Sub Form_Load ()
- ' Declare variables.
- Dim ThisMonth As Integer
- Dim ThisDay As Integer
- Dim ThisYear As Integer
- Dim ThisDays As Long
- ' Center the form on desktop.
- Left = (Screen.Width - Width) / 2
- Top = (Screen.Height - Height) / 2
- ' Set values.
- ThisMonth = Val(Mid$(Date$, 1, 2)) ' Get the current month from the system date.
- ThisDay = Val(Mid$(Date$, 4, 2)) ' Get the current day from the system date.
- ThisYear = Val(Mid$(Date$, 7, 4)) ' Get the current year from the system date.
- ThisDays = ConvertDays(ThisMonth, ThisDay, ThisYear) ' Convert the current date to days.
- ' Display results.
- lblSysDate.Caption = Format(Date$, "dddddd") ' Display the system date.
- lblCvtDate.Caption = ThisDays ' Display the converted date.
- lblFmtDate.Caption = Format(ConvertDate(ThisDays), "dddddd") ' Display the converted date formatted.
- End Sub
-