Local时间向GMT时间的转化(ASP)
'====================================================================
'機能 : ローカル日付をGMT日付に変換する。
'引数 :
' ローカル日付
'返却値 : GMT日付
'====================================================================
Function gfdtLocal2GMT(ByVal LocalDate)
If SG_blnErrorResumeNext Then
On Error Resume Next
End If
Dim intTime
Dim intMinute
Dim dtTempDate
Dim dtOutDate
If Left(SG_strTimeZone, 3) <> "GMT" Then
gfdtLocal2GMT = LocalDate
Exit Function
Else
Select Case Mid(SG_strTimeZone, 4, 1)
Case "+"
intTime = Mid(SG_strTimeZone, 5, 2)
intMinute = Mid(SG_strTimeZone, 8, 2)
If 0 <= intTime And intTime < 24 Then
If 0 <= intMinute And intMinute < 60 Then
dtTempDate = DateAdd("h", -intTime, LocalDate)
dtOutDate = DateAdd("n", -intMinute, dtTempDate)
Else
gfdtLocal2GMT = LocalDate
Exit Function
End If
Else
gfdtLocal2GMT = LocalDate
Exit Function
End If
Case "-"
intTime = Mid(SG_strTimeZone, 5, 2)
intMinute = Mid(SG_strTimeZone, 8, 2)
If 0 <= intTime And intTime < 24 Then
If 0 <= intMinute And intMinute < 60 Then
dtTempDate = DateAdd("h", intTime, LocalDate)
dtOutDate = DateAdd("n", intMinute, dtTempDate)
Else
gfdtLocal2GMT = LocalDate
Exit Function
End If
Else
gfdtLocal2GMT = LocalDate
Exit Function
End If
Case Else
gfdtLocal2GMT = LocalDate
Exit Function
End Select
End If
gfdtLocal2GMT = cdate(dtOutDate)
End Function