ToolTipText = "type the year in the format YYYY to verify whether this year is a leap-year or not"
Top = 720
Width = 1935
End
Begin VB.Label Label21
Caption = "Month"
Height = 255
Left = 1320
TabIndex = 18
Top = 1800
Width = 495
End
Begin VB.Label Label20
Caption = "Year"
Height = 255
Left = 120
TabIndex = 19
Top = 1800
Width = 495
End
Begin VB.Label Label19
Caption = "Type a especific year and a especific month to retrieve the number of days in the especific month"
Height = 495
Left = 120
TabIndex = 20
Top = 1200
Width = 3975
End
Begin VB.Label Label18
Caption = "Type an year in the textbox to verify whether the year is a year of leap ( 29 days in february ) ( ano bissexto)"
Height = 495
Left = 120
TabIndex = 21
Top = 240
Width = 3975
End
End
Begin VB.Frame Frame3
Caption = "DateDiff equivalent functions"
Height = 2775
Left = 120
TabIndex = 38
Top = 3000
Width = 5175
Begin VB.CommandButton Command15
Caption = "Apply"
Height = 255
Left = 1320
TabIndex = 50
Top = 1560
Width = 2055
End
Begin VB.TextBox Text16
Height = 285
Left = 4080
TabIndex = 49
ToolTipText = "here will apear the number of years involving the diference of the two dates"
Top = 2160
Width = 855
End
Begin VB.TextBox Text15
Height = 285
Left = 2760
TabIndex = 47
ToolTipText = "here will apear the number of months involving the diference of the two dates"
Top = 2160
Width = 735
End
Begin VB.TextBox Text14
Height = 285
Left = 600
TabIndex = 45
ToolTipText = "here will apear the number of days involving the diference of the two dates"
Top = 2160
Width = 1455
End
Begin VB.TextBox Text13
Height = 285
Left = 1320
TabIndex = 42
ToolTipText = "type here the final date of the operation"
Top = 1200
Width = 2055
End
Begin VB.TextBox Text12
Height = 285
Left = 1320
TabIndex = 40
ToolTipText = "type here the initial date of the operation"
Top = 600
Width = 2055
End
Begin VB.Label Label17
Caption = "Years"
Height = 255
Left = 3600
TabIndex = 48
Top = 2160
Width = 615
End
Begin VB.Label Label16
Caption = "Months"
Height = 255
Left = 2160
TabIndex = 46
Top = 2160
Width = 855
End
Begin VB.Label Label15
Caption = "Days"
Height = 255
Left = 120
TabIndex = 44
Top = 2160
Width = 615
End
Begin VB.Label Label14
Caption = "These are the diferences between the dates"
Height = 255
Left = 120
TabIndex = 43
Top = 1800
Width = 4935
End
Begin VB.Label Label13
Caption = "Type the final date in the same format as above"
Height = 255
Left = 120
TabIndex = 41
Top = 960
Width = 4335
End
Begin VB.Label Label12
Caption = "Type the initial date in the format yyyymmdd like it 19981225"
Height = 375
Left = 120
TabIndex = 39
Top = 240
Width = 4935
End
End
Begin VB.Frame Frame2
Caption = "Date calculations"
Height = 3495
Left = 5400
TabIndex = 22
Top = 0
Width = 4215
Begin VB.TextBox Text11
Height = 285
Left = 2040
TabIndex = 37
ToolTipText = "type the value "
Top = 1320
Width = 2055
End
Begin VB.CommandButton Command14
Caption = "Apply the operation"
Height = 975
Left = 120
TabIndex = 35
Top = 2400
Width = 1815
End
Begin VB.TextBox Text10
Height = 285
Left = 2040
TabIndex = 34
ToolTipText = "result of the operation"
Top = 3000
Width = 2055
End
Begin VB.TextBox Text9
Height = 285
Left = 2040
TabIndex = 31
ToolTipText = "you can type directly here the operation , like +d to make operations involving days"
Top = 2280
Width = 2055
End
Begin VB.TextBox Text8
Height = 285
Left = 2040
TabIndex = 30
ToolTipText = "type here the date to be applied to the operation in the BW date format"
Top = 600
Width = 2055
End
Begin VB.CommandButton Command13
Caption = "Decrease years -y"
Height = 255
Left = 120
TabIndex = 28
Top = 2040
Width = 1695
End
Begin VB.CommandButton Command12
Caption = "Decrease months -m"
Height = 255
Left = 120
TabIndex = 27
Top = 1680
Width = 1695
End
Begin VB.CommandButton Command11
Caption = "Decrease days -d"
Height = 255
Left = 120
TabIndex = 26
Top = 1320
Width = 1695
End
Begin VB.CommandButton Command10
Caption = "Add years +y"
Height = 255
Left = 120
TabIndex = 25
Top = 960
Width = 1695
End
Begin VB.CommandButton Command9
Caption = "Add months +m"
Height = 255
Left = 120
TabIndex = 24
Top = 600
Width = 1695
End
Begin VB.CommandButton Command8
Caption = "Add days +d"
Height = 255
Left = 120
TabIndex = 23
Top = 240
Width = 1695
End
Begin VB.Label Label11
Caption = "Type the value to be evaluated by the operation"
Height = 495
Left = 2040
TabIndex = 36
Top = 960
Width = 2055
End
Begin VB.Label Label10
Caption = "Here will apear the date with the result of the operation"
Height = 375
Left = 2040
TabIndex = 33
Top = 2640
Width = 2055
End
Begin VB.Label Label9
Caption = "Click the button to select the operation and here will apear the operation to be applied"
Height = 615
Left = 2040
TabIndex = 32
Top = 1680
Width = 2055
End
Begin VB.Label Label8
Caption = "Type the initial date (eight characters , YYYYMMDD)"
Height = 375
Left = 2040
TabIndex = 29
Top = 240
Width = 2055
End
End
Begin VB.TextBox Text7
Height = 285
Left = 4200
TabIndex = 13
ToolTipText = "type the year to set your system date"
Top = 2400
Width = 975
End
Begin VB.Timer Timer1
Interval = 1000
Left = 7680
Top = 360
End
Begin VB.CommandButton Command7
Caption = "Set the year of the system"
Height = 255
Left = 240
TabIndex = 12
Top = 2400
Width = 2175
End
Begin VB.TextBox Text6
Height = 285
Left = 4200
TabIndex = 11
ToolTipText = "type the month to set your system date"
Top = 2040
Width = 975
End
Begin VB.CommandButton Command6
Caption = "Set the month of the system"
Height = 255
Left = 240
TabIndex = 10
Top = 2040
Width = 2175
End
Begin VB.TextBox Text5
Height = 285
Left = 4200
TabIndex = 9
ToolTipText = "type the day to set your system date"
Top = 1680
Width = 975
End
Begin VB.CommandButton Command5
Caption = "Set the day of the system"
Height = 255
Left = 240
TabIndex = 8
Top = 1680
Width = 2175
End
Begin VB.TextBox Text4
Height = 285
Left = 4200
TabIndex = 7
ToolTipText = "here will apear the year"
Top = 1320
Width = 975
End
Begin VB.CommandButton Command4
Caption = "Get the year"
Height = 255
Left = 240
TabIndex = 6
Top = 1320
Width = 2175
End
Begin VB.TextBox Text3
Height = 285
Left = 4200
TabIndex = 5
ToolTipText = "here will apear the month"
Top = 960
Width = 975
End
Begin VB.CommandButton Command3
Caption = "Get the month"
Height = 255
Left = 240
TabIndex = 4
Top = 960
Width = 2175
End
Begin VB.TextBox Text2
Height = 285
Left = 4200
TabIndex = 3
ToolTipText = "Here will apear the day"
Top = 600
Width = 975
End
Begin VB.CommandButton Command2
Caption = "Get the day"
Height = 255
Left = 240
TabIndex = 2
Top = 600
Width = 2175
End
Begin VB.Frame Frame1
Caption = "Date functions"
Height = 2895
Left = 120
TabIndex = 51
Top = 0
Width = 5175
Begin VB.TextBox Text1
Height = 285
Left = 4080
TabIndex = 60
Top = 240
Width = 975
End
Begin VB.CommandButton Command1
Caption = "Get the date"
Height = 255
Left = 120
TabIndex = 58
Top = 240
Width = 2175
End
Begin VB.Label Label7
Caption = "Date of the system"
Height = 255
Left = 2520
TabIndex = 59
Top = 240
Width = 1455
End
Begin VB.Label Label6
Caption = "Type the year"
Height = 255
Left = 2520
TabIndex = 57
Top = 2400
Width = 1455
End
Begin VB.Label Label5
Caption = "Type the month"
Height = 255
Left = 2520
TabIndex = 56
Top = 2040
Width = 1455
End
Begin VB.Label Label4
Caption = "Type the day"
Height = 255
Left = 2520
TabIndex = 55
Top = 1680
Width = 1335
End
Begin VB.Label Label3
Caption = "Year"
Height = 255
Left = 2520
TabIndex = 54
Top = 1320
Width = 1455
End
Begin VB.Label Label2
Caption = "Month"
Height = 255
Left = 2520
TabIndex = 53
Top = 960
Width = 1455
End
Begin VB.Label Label1
Caption = "Day"
Height = 255
Left = 2520
TabIndex = 52
Top = 600
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'This application is a sample to demonstrate the possibilities of the
'BinaryWork Time Machine OCX
'This OCX was developed to fix some bugs in the date data type ( the bug is explained in the help file ), and
'to make your applications compliant with the international market
'and to avoid the Y2K problem
'This sample will explore all the possibilities of the OCX
' developed by BinaryWork Corp. BynaryWork@geocities.com
Private Sub about_Click()
TimeMachine1.AboutBox
End Sub
Private Sub Command1_Click()
Text1.Text = TimeMachine1.GetDate
End Sub
Private Sub Command10_Click()
Text9.Text = "+y"
End Sub
Private Sub Command11_Click()
Text9.Text = "-d"
End Sub
Private Sub Command12_Click()
Text9.Text = "-m"
End Sub
Private Sub Command13_Click()
Text9.Text = "-y"
End Sub
Private Sub Command14_Click()
If Len(Text8.Text) <> 8 Then MsgBox "you need to type the date in the format yyyymmdd , and without separators , like it 19981225 ": Text8.SetFocus: Exit Sub
If Len(Text9.Text) = 0 Then MsgBox "you need to select the operation , the valid operations are +d +m +y -d -m -y ": Text9.SetFocus: Exit Sub
If Len(Text11.Text) = 0 Then MsgBox "you need to select the value to be evaluated by the operation , to add 10 days to your date , type 10 in the value textbox and +d in the operation textbox ": Text11.SetFocus: Exit Sub
Dim Ret As Boolean
Dim Myreturn As Long
Text10.Text = 0 ' the function is expecting for a long in the finaldate variable , this is why we need to initiate the variable with a 0
Myreturn = Text10.Text 'the result will be retrieved in the myfunction variable
Ret = TimeMachine1.CalcDate(Text9.Text, Text11.Text, Text8.Text, Myreturn)
Text10.Text = Myreturn '<- this is the data retrieved by the operation
If Ret = True Then
MsgBox "the operation was evaluated successfully"
MsgBox "an error occurred , please , verify the data entered or read the help file "
End If
End Sub
Private Sub Command15_Click()
If Len(Text12.Text) <> 8 Then MsgBox "You need to type the initial date , 8 characters) : text12.setfocus : exit sub"
If Len(Text13.Text) <> 8 Then MsgBox "You need to type the final date , 8 characters) : text13.setfocus : exit sub"
Dim Ret As Boolean
Dim mYday As Long
Dim mYyear As Long
Dim mYmonth As Long
Ret = TimeMachine1.BWDatediff(Text12.Text, Text13.Text, mYday, mYmonth, mYyear)
Text14.Text = mYday
Text15.Text = mYmonth
Text16.Text = mYyear
If Ret = False Then MsgBox "an error occurred , please verify the date entered"
End Sub
Private Sub Command16_Click()
If Len(Text17.Text) <> 4 Then MsgBox "type the year with four digits": Exit Sub
Dim Ret As Long
Ret = TimeMachine1.VerifyYearOfLeap(Text17.Text)
If Ret Then
MsgBox "this year is a year of leap"
MsgBox "this year isnot a year of leap"
End If
End Sub
Private Sub Command17_Click()
If Len(Text18.Text) <> 4 Then MsgBox "type four digits to the year": Exit Sub
Dim Ret As Long
Ret = TimeMachine1.DaysInaMonth(Text18.Text, Text19.Text)
MsgBox "Number of days in the especific month : " & Ret
End Sub
Private Sub Command2_Click()
Text2.Text = TimeMachine1.GetDay
End Sub
Private Sub Command3_Click()
Text3.Text = TimeMachine1.GetMonth
End Sub
Private Sub Command4_Click()
Text4.Text = TimeMachine1.GetYear
End Sub
Private Sub Command5_Click()
Dim Ret As Boolean
Ret = TimeMachine1.SetDay(Text5.Text)
If Ret = True Then
MsgBox "the day was set successfully ", , "Time Machine"
MsgBox "The function retrieve an error , please verify whether the value entered is correct to a day", , "Time Machine"
End If
End Sub
Private Sub Command6_Click()
Dim Ret As Boolean
Ret = TimeMachine1.SetMonth(Text6.Text)
If Ret = True Then
MsgBox "the month was set successfully ", , "Time Machine"
MsgBox "The function retrieve an error , please verify whether the value entered is correct to a month", , "Time Machine"
End If
End Sub
Private Sub Command7_Click()
Dim Ret As Boolean
Ret = TimeMachine1.SetYear(Text7.Text)
If Ret = True Then
MsgBox "the year was set successfully ", , "Time Machine"
MsgBox "The function retrieve an error , please verify whether the value entered is correct to a year", , "Time Machine"
End If
End Sub
Private Sub Command8_Click()
Text9.Text = "+d"
End Sub
Private Sub Command9_Click()
Text9.Text = "+m"
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Timer1_Timer()
'obviously our ocx dont need the date data type of VB
'we are using it only to show the date in the known method
'and as you obviously know we dont recommend the use of the date data type ( if you want to develop international applications )
Form1.Caption = "BinaryWork Time Machine OCX - Sample - System date : " & Date 'please , dont use the date data type in your applications , this will avoid problems in the future