home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / calculat / date_vb.zip / DEMO.FRM < prev    next >
Text File  |  1993-09-10  |  3KB  |  102 lines

  1. VERSION 2.00
  2. Begin Form frmDate 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Date Demonstration"
  5.    ClientHeight    =   1245
  6.    ClientLeft      =   2490
  7.    ClientTop       =   2535
  8.    ClientWidth     =   4650
  9.    Height          =   1710
  10.    Left            =   2400
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   5.188
  13.    ScaleMode       =   4  'Character
  14.    ScaleWidth      =   38.75
  15.    Top             =   2160
  16.    Width           =   4830
  17.    Begin Label lblFmtdate 
  18.       BorderStyle     =   1  'Fixed Single
  19.       Height          =   240
  20.       Left            =   1440
  21.       TabIndex        =   3
  22.       Top             =   840
  23.       Width           =   3000
  24.    End
  25.    Begin Label lblCvtDate 
  26.       BorderStyle     =   1  'Fixed Single
  27.       Height          =   240
  28.       Left            =   1440
  29.       TabIndex        =   4
  30.       Top             =   480
  31.       Width           =   3000
  32.    End
  33.    Begin Label lblSysDate 
  34.       BorderStyle     =   1  'Fixed Single
  35.       Height          =   240
  36.       Left            =   1440
  37.       TabIndex        =   5
  38.       Top             =   120
  39.       Width           =   3000
  40.    End
  41.    Begin Label label 
  42.       Alignment       =   1  'Right Justify
  43.       BackStyle       =   0  'Transparent
  44.       Caption         =   "Days to Date:"
  45.       Height          =   240
  46.       Index           =   2
  47.       Left            =   180
  48.       TabIndex        =   2
  49.       Top             =   840
  50.       Width           =   1245
  51.    End
  52.    Begin Label label 
  53.       Alignment       =   1  'Right Justify
  54.       BackStyle       =   0  'Transparent
  55.       Caption         =   "Date to Days:"
  56.       Height          =   240
  57.       Index           =   1
  58.       Left            =   180
  59.       TabIndex        =   1
  60.       Top             =   480
  61.       Width           =   1245
  62.    End
  63.    Begin Label label 
  64.       Alignment       =   1  'Right Justify
  65.       BackStyle       =   0  'Transparent
  66.       Caption         =   "System Date:"
  67.       Height          =   240
  68.       Index           =   0
  69.       Left            =   180
  70.       TabIndex        =   0
  71.       Top             =   120
  72.       Width           =   1245
  73.    End
  74. End
  75. Option Explicit
  76.  
  77. Sub Form_Load ()
  78.  
  79.     ' Declare variables.
  80.     Dim ThisMonth   As Integer
  81.     Dim ThisDay     As Integer
  82.     Dim ThisYear    As Integer
  83.     Dim ThisDays    As Long
  84.     
  85.     ' Center the form on desktop.
  86.     Left = (Screen.Width - Width) / 2
  87.     Top = (Screen.Height - Height) / 2
  88.  
  89.     ' Set values.
  90.     ThisMonth = Val(Mid$(Date$, 1, 2))                              ' Get the current month from the system date.
  91.     ThisDay = Val(Mid$(Date$, 4, 2))                                ' Get the current day from the system date.
  92.     ThisYear = Val(Mid$(Date$, 7, 4))                               ' Get the current year from the system date.
  93.     ThisDays = ConvertDays(ThisMonth, ThisDay, ThisYear)           ' Convert the current date to days.
  94.  
  95.     ' Display results.
  96.     lblSysDate.Caption = Format(Date$, "dddddd")                    ' Display the system date.
  97.     lblCvtDate.Caption = ThisDays                                   ' Display the converted date.
  98.     lblFmtDate.Caption = Format(ConvertDate(ThisDays), "dddddd")   ' Display the converted date formatted.
  99.  
  100. End Sub
  101.  
  102.