PsychoCoder
Programmer
In my application I have these 2 functions (yes they were posted in a previous post)
When the ConvertGMT function is called it works great, unless the offset is a floating point number (ie; 9.5), then it adds the 9 but not the .5. Anyone got any ideas?
Senior Qik III, ASP.Net, VB.Net ,SQL Programmer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
Public Function GetGMTOffset(ByVal sAirport As String) As Double
Dim dOffset As Double
sSQL = "EXECUTE ama_GetGMTOffset @airport"
cmdCommand = New SqlCommand(sSQL, cnConnection)
cmdCommand.Parameters.AddWithValue("@airport", sAirport)
Try
cnConnection.Open()
dOffset = cmdCommand.ExecuteScalar
Return dOffset
Catch exSQL As SqlException
MsgBox(SQL_EXCEPTION, MsgBoxStyle.Critical, "Database Error")
Catch exSQLTimeout As TimeoutException
MsgBox(SQL_TIMEOUT, MsgBoxStyle.Critical, "Timeout Error")
Catch exApp As ApplicationException
MsgBox(APP_EXCEPTION, MsgBoxStyle.Critical, "Application Error")
Catch ex As Exception
MsgBox(GENERAL_EXCEPTION & ex.Message, MsgBoxStyle.Critical, "General Error")
Finally
cnConnection.Close()
End Try
End Function
Code:
Public Function ConvertGMT(ByVal dLocalDate As DateTime, ByVal sAirport As String) As DateTime
_dGMTTime = DateAdd(DateInterval.Hour, CType(GetGMTOffset(sAirport), Double), dLocalDate)
Return _dGMTTime
End Function
When the ConvertGMT function is called it works great, unless the offset is a floating point number (ie; 9.5), then it adds the 9 but not the .5. Anyone got any ideas?
Senior Qik III, ASP.Net, VB.Net ,SQL Programmer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"In the new millennium there will be two kinds of business; those on the net and those out of business"
~ Bill Gates ~