2008-08-18, 09:36 AM
|
#1
|
註冊會員
|
關於VB6寫一個各地時間的問題?
請問一下以下程式碼要如何修改才不會有負數的
我是想要修改成 24時時自動進 位到 00時
而且日期也加一天
但是這樣子的時間計算問題就難倒我了
而且又想寫出一個符合各地時間的程式
所以只好請各位大大幫忙嚕
程式碼並包含FRM檔各項資訊如下
引用:
VERSION 5.00
Begin VB.Form Form2
BorderStyle = 1 '單線固定
Caption = "各地時間"
ClientHeight = 4725
ClientLeft = 9075
ClientTop = 5715
ClientWidth = 5760
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4725
ScaleWidth = 5760
ShowInTaskbar = 0 'False
Begin VB.Timer Timer1
Interval = 100
Left = 300
Top = 4200
End
Begin VB.CommandButton Command1
Caption = "關閉"
Height = 390
Left = 4125
TabIndex = 8
Top = 4275
Width = 1440
End
Begin VB.Frame Frame1
Caption = "各地時間"
Height = 3915
Left = 300
TabIndex = 0
Top = 225
Width = 5265
Begin VB.TextBox Text28
Height = 315
Left = 2100
TabIndex = 58
Text = "Text1"
Top = 300
Width = 465
End
Begin VB.TextBox Text27
Height = 315
Left = 2100
TabIndex = 57
Text = "Text1"
Top = 750
Width = 465
End
Begin VB.TextBox Text26
Height = 315
Left = 2100
TabIndex = 56
Text = "Text1"
Top = 1200
Width = 465
End
Begin VB.TextBox Text25
Height = 315
Left = 2100
TabIndex = 55
Text = "Text1"
Top = 1650
Width = 465
End
Begin VB.TextBox Text24
Height = 315
Left = 2100
TabIndex = 54
Text = "Text1"
Top = 2100
Width = 465
End
Begin VB.TextBox Text23
Height = 315
Left = 2100
TabIndex = 53
Text = "Text1"
Top = 2550
Width = 465
End
Begin VB.TextBox Text22
Height = 315
Left = 2100
TabIndex = 52
Text = "Text1"
Top = 3000
Width = 465
End
Begin VB.TextBox Text21
Height = 315
Left = 4350
TabIndex = 36
Text = "Text1"
Top = 300
Width = 465
End
Begin VB.TextBox Text20
Height = 315
Left = 4350
TabIndex = 35
Text = "Text1"
Top = 750
Width = 465
End
Begin VB.TextBox Text19
Height = 315
Left = 4350
TabIndex = 34
Text = "Text1"
Top = 1200
Width = 465
End
Begin VB.TextBox Text18
Height = 315
Left = 4350
TabIndex = 33
Text = "Text1"
Top = 1650
Width = 465
End
Begin VB.TextBox Text17
Height = 315
Left = 4350
TabIndex = 32
Text = "Text1"
Top = 2100
Width = 465
End
Begin VB.TextBox Text16
Height = 315
Left = 4350
TabIndex = 31
Text = "Text1"
Top = 2550
Width = 465
End
Begin VB.TextBox Text15
Height = 315
Left = 4350
TabIndex = 30
Text = "Text1"
Top = 3000
Width = 465
End
Begin VB.TextBox Text14
Height = 315
Left = 3600
TabIndex = 22
Text = "Text1"
Top = 300
Width = 465
End
Begin VB.TextBox Text13
Height = 315
Left = 3600
TabIndex = 21
Text = "Text1"
Top = 750
Width = 465
End
Begin VB.TextBox Text12
Height = 315
Left = 3600
TabIndex = 20
Text = "Text1"
Top = 1200
Width = 465
End
Begin VB.TextBox Text11
Height = 315
Left = 3600
TabIndex = 19
Text = "Text1"
Top = 1650
Width = 465
End
Begin VB.TextBox Text10
Height = 315
Left = 3600
TabIndex = 18
Text = "Text1"
Top = 2100
Width = 465
End
Begin VB.TextBox Text9
Height = 315
Left = 3600
TabIndex = 17
Text = "Text1"
Top = 2550
Width = 465
End
Begin VB.TextBox Text8
Height = 315
Left = 3600
TabIndex = 16
Text = "Text1"
Top = 3000
Width = 465
End
Begin VB.TextBox Text7
Height = 315
Left = 2850
TabIndex = 15
Text = "Text1"
Top = 3000
Width = 465
End
Begin VB.TextBox Text6
Height = 315
Left = 2850
TabIndex = 14
Text = "Text1"
Top = 2550
Width = 465
End
Begin VB.TextBox Text5
Height = 315
Left = 2850
TabIndex = 13
Text = "Text1"
Top = 2100
Width = 465
End
Begin VB.TextBox Text4
Height = 315
Left = 2850
TabIndex = 12
Text = "Text1"
Top = 1650
Width = 465
End
Begin VB.TextBox Text3
Height = 315
Left = 2850
TabIndex = 11
Text = "Text1"
Top = 1200
Width = 465
End
Begin VB.TextBox Text2
Height = 315
Left = 2850
TabIndex = 10
Text = "Text1"
Top = 750
Width = 465
End
Begin VB.TextBox Text1
Height = 315
Left = 2850
TabIndex = 9
Text = "Text1"
Top = 300
Width = 465
End
Begin VB.Label Label36
Caption = "日"
Height = 165
Left = 2625
TabIndex = 65
Top = 3150
Width = 165
End
Begin VB.Label Label35
Caption = "日"
Height = 165
Left = 2625
TabIndex = 64
Top = 2700
Width = 165
End
Begin VB.Label Label34
Caption = "日"
Height = 165
Left = 2625
TabIndex = 63
Top = 2250
Width = 165
End
Begin VB.Label Label33
Caption = "日"
Height = 165
Left = 2625
TabIndex = 62
Top = 1800
Width = 165
End
Begin VB.Label Label32
Caption = "日"
Height = 165
Left = 2625
TabIndex = 61
Top = 1350
Width = 165
End
Begin VB.Label Label31
Caption = "日"
Height = 165
Left = 2625
TabIndex = 60
Top = 900
Width = 165
End
Begin VB.Label Label30
Caption = "日"
Height = 165
Left = 2625
TabIndex = 59
Top = 450
Width = 165
End
Begin VB.Label Label29
Caption = "註 : 程式設計時以台灣時間 (GMT+08:00) 為基礎"
Height = 165
Left = 75
TabIndex = 51
Top = 3675
Width = 4890
End
Begin VB.Label Label28
Caption = "秒"
Height = 165
Left = 4875
TabIndex = 50
Top = 450
Width = 165
End
Begin VB.Label Label27
Caption = "秒"
Height = 240
Left = 4875
TabIndex = 49
Top = 900
Width = 165
End
Begin VB.Label Label26
Caption = "秒"
Height = 240
Left = 4875
TabIndex = 48
Top = 1350
Width = 165
End
Begin VB.Label Label25
Caption = "秒"
Height = 240
Left = 4875
TabIndex = 47
Top = 1800
Width = 165
End
Begin VB.Label Label24
Caption = "秒"
Height = 165
Left = 4875
TabIndex = 46
Top = 2250
Width = 165
End
Begin VB.Label Label23
Caption = "秒"
Height = 240
Left = 4875
TabIndex = 45
Top = 2625
Width = 165
End
Begin VB.Label Label22
Caption = "秒"
Height = 240
Left = 4875
TabIndex = 44
Top = 3150
Width = 165
End
Begin VB.Label Label21
Caption = "分"
Height = 165
Left = 4125
TabIndex = 43
Top = 450
Width = 165
End
Begin VB.Label Label20
Caption = "分"
Height = 165
Left = 4125
TabIndex = 42
Top = 900
Width = 165
End
Begin VB.Label Label19
Caption = "分"
Height = 165
Left = 4125
TabIndex = 41
Top = 1350
Width = 165
End
Begin VB.Label Label18
Caption = "分"
Height = 165
Left = 4125
TabIndex = 40
Top = 1800
Width = 165
End
Begin VB.Label Label17
Caption = "分"
Height = 165
Left = 4125
TabIndex = 39
Top = 2250
Width = 165
End
Begin VB.Label Label16
Caption = "分"
Height = 165
Left = 4125
TabIndex = 38
Top = 2700
Width = 165
End
Begin VB.Label Label15
Caption = "分"
Height = 165
Left = 4125
TabIndex = 37
Top = 3150
Width = 165
End
Begin VB.Label Label14
Caption = "時"
Height = 165
Left = 3375
TabIndex = 29
Top = 450
Width = 165
End
Begin VB.Label Label13
Caption = "時"
Height = 165
Left = 3375
TabIndex = 28
Top = 900
Width = 165
End
Begin VB.Label Label12
Caption = "時"
Height = 165
Left = 3375
TabIndex = 27
Top = 1350
Width = 165
End
Begin VB.Label Label11
Caption = "時"
Height = 165
Left = 3375
TabIndex = 26
Top = 1800
Width = 165
End
Begin VB.Label Label10
Caption = "時"
Height = 165
Left = 3375
TabIndex = 25
Top = 2250
Width = 165
End
Begin VB.Label Label9
Caption = "時"
Height = 165
Left = 3375
TabIndex = 24
Top = 2700
Width = 165
End
Begin VB.Label Label8
Caption = "時"
Height = 165
Left = 3375
TabIndex = 23
Top = 3150
Width = 165
End
Begin VB.Label Label7
Caption = "美國時間"
Height = 240
Left = 225
TabIndex = 7
Top = 3150
Width = 1215
End
Begin VB.Label Label6
Caption = "泰國時間"
Height = 240
Left = 225
TabIndex = 6
Top = 2700
Width = 840
End
Begin VB.Label Label5
Caption = "韓國時間"
Height = 165
Left = 225
TabIndex = 5
Top = 2250
Width = 840
End
Begin VB.Label Label4
Caption = "香港時間"
Height = 240
Left = 225
TabIndex = 4
Top = 1800
Width = 840
End
Begin VB.Label Label3
Caption = "中國時間"
Height = 240
Left = 225
TabIndex = 3
Top = 1350
Width = 915
End
Begin VB.Label Label2
Caption = "台灣時間"
Height = 240
Left = 225
TabIndex = 2
Top = 900
Width = 840
End
Begin VB.Label Label1
Caption = "GMT"
Height = 165
Left = 225
TabIndex = 1
Top = 450
Width = 915
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Form2.Hide
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = "GMT"
Label2.Caption = "台灣時間"
Label3.Caption = "中國時間"
Label4.Caption = "香港時間"
Label5.Caption = "韓國時間"
Label6.Caption = "泰國時間"
Label7.Caption = "美國時間"
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label1.Caption = "GMT"
Label2.Caption = "台灣時間"
Label3.Caption = "中國時間"
Label4.Caption = "香港時間"
Label5.Caption = "韓國時間"
Label6.Caption = "泰國時間"
Label7.Caption = "美國時間"
End Sub
Private Sub Label3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label3.Caption = "北京"
End Sub
Private Sub Label5_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label5.Caption = "南韓"
End Sub
Private Sub Label7_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Label7.Caption = "美東華盛頓"
End Sub
Private Sub Timer1_Timer()
gmthr = Hour(Time) - 8
gmtmin = Minute(Time)
gmtsec = Second(Time)
gmtday = Day(Date)
Text1.Text = "" & gmthr
Text2.Text = "" & gmthr + 8
Text3.Text = "" & gmthr + 8
Text4.Text = "" & gmthr + 8
Text5.Text = "" & gmthr + 9
Text6.Text = "" & gmthr + 7
Text7.Text = "" & gmthr - 5
Text8.Text = "" & gmtmin
Text9.Text = "" & gmtmin
Text10.Text = "" & gmtmin
Text11.Text = "" & gmtmin
Text12.Text = "" & gmtmin
Text13.Text = "" & gmtmin
Text14.Text = "" & gmtmin
Text15.Text = "" & gmtsec
Text16.Text = "" & gmtsec
Text17.Text = "" & gmtsec
Text18.Text = "" & gmtsec
Text19.Text = "" & gmtsec
Text20.Text = "" & gmtsec
Text21.Text = "" & gmtsec
Text22.Text = "" & gmtday
Text23.Text = "" & gmtday
Text24.Text = "" & gmtday
Text25.Text = "" & gmtday
Text26.Text = "" & gmtday
Text27.Text = "" & gmtday
Text28.Text = "" & gmtday
If Text1.Text <= -1 Then Text28.Text = "" & gmtday - 1
If Text2.Text <= -1 Then Text27.Text = "" & gmtday - 1
If Text3.Text <= -1 Then Text26.Text = "" & gmtday - 1
If Text4.Text <= -1 Then Text25.Text = "" & gmtday - 1
If Text5.Text <= -1 Then Text24.Text = "" & gmtday - 1
If Text6.Text <= -1 Then Text23.Text = "" & gmtday - 1
If Text7.Text <= -1 Then Text22.Text = "" & gmtday - 1
If Text1.Text >= 24 Then Text28.Text = "" & gmtday + 1 ' And Text1.Text - 24
If Text2.Text >= 24 Then Text27.Text = "" & gmtday + 1
If Text3.Text >= 24 Then Text26.Text = "" & gmtday + 1
If Text4.Text >= 24 Then Text25.Text = "" & gmtday + 1
If Text5.Text >= 24 Then Text24.Text = "" & gmtday + 1 ' And Text5.Text - 24
If Text6.Text >= 24 Then Text23.Text = "" & gmtday + 1 ' And Text6.Text - 24
If Text7.Text >= 24 Then Text22.Text = "" & gmtday + 1 ' And Text7.Text - 24
If Text1.Text = 24 Then Text1.Text = "" & gmthr - 24
If Text2.Text = 24 Then Text2.Text = "" & gmthr - 24
If Text3.Text = 24 Then Text3.Text = "" & gmthr - 24
If Text4.Text = 24 Then Text4.Text = "" & gmthr - 24
If Text5.Text = 24 Then Text5.Text = "" & gmthr - 24
If Text6.Text = 24 Then Text6.Text = "" & gmthr - 24
If Text7.Text = 24 Then Text7.Text = "" & gmthr - 24
End Sub
|
|
|
|
送花文章: 764,
收花文章: 211 篇, 收花: 412 次
|