by C.R.RAJAGOPAL STAR TECHNOLOGIES (3 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 14th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
IT SHOWS DAY OF ANY DATE
API Declarations
'* PROGRAMMED BY C.R.RAJAGOPAL *
'* STAR TECHNOLOGIES *
'* E.MAIL: CRRZUNICA @ YAHOO.COM *
'PLACE 3 COMMAND BUTTONS WITH NAMES CMDQUIT,CMDNEXT,CMDOK AND CAPTIONS QUIT,NEXT,SHOW DAY 'RESPECTIVELY
'PLACE 7 LABELS
'LABEL1:CAPTION:ENTER DATE
'LABEL2.CAPTION:DATE
'LABEL3.CAPTION:MONTH
'LABEL4.CAPTION:YEAR
'LABEL5.CAPTION:DAY IS
'LABEL6.CAPTION=" " THAT IS IT IS BLANK OR EMPTY
'LABEL7.CAPTION=DATE AND MONTH ARE IN TWO DIGITS AND YEAR IN FOUR DIGITS
'PLACE 3 TEXTBOXES TEXT1,TEXT2,TEXT3 AND THEIR TEXT BE EMPTY
'THE LAYOUT IS AS FOLLOWS
'============================================================
'+ DATE MONTH YEAR +
'+ ENTER DATE TXT1 TXT2 TXT3 +
'+ +
'+ DAY IS LABEL6 +
'+ DATE AND MONTH ARE IN TWO DIGITS AND YEAR IN FOUR DIGITS +
'+ +
'+ QUIT NEXT SHOWDAY +
'+===========================================================
Dim p, q, d, m, Y As Integer
Unload Me
End
End Sub
Private Sub cmdnext_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label5.Visible = False
Label6.Visible = False
Label7.Visible = True
End Sub
Private Sub cmdok_Click()
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Exit Sub
ElseIf Len(Text3.Text) < 4 Or Len(Text1.Text) > 2 Or Len(Text2.Text) > 2 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Exit Sub
ElseIf CInt(Text1.Text) = 0 Or CInt(Text2.Text) = 0 Or CInt(Text3.Text) = 0 Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
Label7.Visible = False
d = CInt(Text1.Text)
m = CInt(Text2.Text)
Y = CInt(Text3.Text)
If m = 1 Or m = 2 Then
m = m + 12
Y = Y - 1
End If
p = d + (2 * m) + Int((3 * m + 3) / 5) + Y + Int(Y / 4) + Int(Y / 400) - Int(Y / 100) + 1
q = p - 7 * Int(p / 7) + 1
Select Case q
Case Is = 1
Label6.Caption = "Sunday"
Case Is = 2
Label6.Caption = "Monday"
Case Is = 3
Label6.Caption = "Tuesday"
Case Is = 4
Label6.Caption = "Wednesday"
Case Is = 5
Label6.Caption = "Thursday"
Case Is = 6
Label6.Caption = "Friday"
Case Is = 7
Label6.Caption = "Saturday"
Case Is = 0
Label6.Caption = "Saturday"
End Select
Label5.Visible = True
Label6.Visible = True
End If
cmdquit.SetFocus
End Sub
Private Sub Form_Activate()
Text1.SetFocus
Label5.Visible = False
Label6.Visible = False
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label6.Caption = "Result"
Label5.Visible = False
Label6.Visible = False
Label7.Visible = True
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdok.SetFocus
End If
End Sub