Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2004

    Unanswered: Visual Basic & Oracle Date question

    Not sure where to put this post....

    In Visual Basic, I've had to change the date format to fit with our Oracle database, namely: DD.MM.YYYY hh24:mi:ss

    Here's the problem:

    Public Function LocalDateToUTC(ByVal vDate, Optional sSummerFlag As String = "W") As Date
    Dim lRet As Long

    lRet = GetTimeZoneInformation(tzi)
    If sSummerFlag = "S" Then
    LocalDateToUTC = DateAdd("n", tzi.Bias + tzi.DaylightBias, vDate)

    where "n" represents minutes in VB
    tzi.Bias = -60
    tzi.DaylightBias = 0
    vDate = 01.09.1997 01:00:00
    and before the DateAdd gives an error, LocalDateToUTC = 12:00:00 AM

    As you can guess, I'm trying to subtract an hour for the time zone. But because vDate is in DD.MM.YYYY hh24:mi:ss format, I don't think VB's "DateAdd" function works. Unfortunately, I can't use TO_CHAR either. Furthermore, because LocalDateToUTC is defined as Date, it must see vDate as something else, because if I just put LocalDateToUTC = vDate, I get "Type Mismatch" error.

    If I just put at the end LocalDateToUTC = #1/1/1970# it works. I don't get it.

    So... how do I make LocalDateToUTC accept the above format that I want, so it passes back the correct value?
    Last edited by ezrasuncle; 02-06-04 at 07:15.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts