converting PST/PDT time to GMT time 
Author Message
 converting PST/PDT time to GMT time

I am using ADo in VB6.0 & database is oracle8.0. I have to select the records from database where time=user input time. The user will enter the time in PST/PDT.
I need to take the time interval of 30 mins if user enters the datetime, 03/23/01 23:05:00 then it should returns all the records from database within nearest 30 min interval. All the data  in database is in GMT time. This input time should first cahge to GMT time & then rounds to nearest time interval. It is really complicated.

Any idea how to do coding for this.
Any help in this regard will bw appreciated.

Thanks

Mamta

_______________________________________________
Submitted via WebNewsReader of http://www.*-*-*.com/



Fri, 12 Sep 2003 06:54:30 GMT  
 converting PST/PDT time to GMT time
DateAdd perhaps?  PST is GMT - 8.

On Sun, 25 Mar 2001 22:54:30 +0000, Mamta

Quote:

>I am using ADo in VB6.0 & database is oracle8.0. I have to select the records from database where time=user input time. The user will enter the time in PST/PDT.
>I need to take the time interval of 30 mins if user enters the datetime, 03/23/01 23:05:00 then it should returns all the records from database within nearest 30 min interval. All the data  in database is in GMT time. This input time should first cahge to GMT time & then rounds to nearest time interval. It is really complicated.

>Any idea how to do coding for this.
>Any help in this regard will bw appreciated.



Fri, 12 Sep 2003 23:52:07 GMT  
 converting PST/PDT time to GMT time
Hi....

I'm reasonably new to VB... but I was interested in this topic and came up
with the following
If you read the text below, i used a makeshift routine to convert the
integer array into an ASCII string. I guess this wouldnt work for unicode
characters.... but hey!! I'm only a novice. I dont know any other way to
convert the integer array into a string (perhaps someone else knows how to
do that more efficiently).

Basically I determined that the  GetTimeZOneInformation function gives you
the bias from your local time one to UTC.... But you can check this out for
yourself searching MSDN using TIME_ZONE_INFORMATION
So you just add that to your local time to get GMT/UTC... I'm not sure how
daylight savings affects this, I guess you just add the daylightbias value
also?

anyways...... good luck... hope this helped

Put the following in your Module

--- CUT  -----

Public Declare Function GetTimeZoneInformation Lib "kernel32"
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long

Public Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type

Public Type TIME_ZONE_INFORMATION
        Bias As Long
        StandardName(32) As Integer
        StandardDate As SYSTEMTIME
        StandardBias As Long
        DaylightName(32) As Integer
        DaylightDate As SYSTEMTIME
        DaylightBias As Long
End Type

---- CUT -------

And you can put this anywhere.... Just to demonstrate it working

Private Sub Form_Load()

Dim local_tz As TIME_ZONE_INFORMATION
Dim dword As Variant
Dim msgtxt As String

dword = GetTimeZoneInformation(local_tz)

msgtxt = "Time Now " & Now() & vbCrLf
msgtxt = msgtxt & "Bias :" & local_tz.Bias & vbCrLf
msgtxt = msgtxt & "Standard Name : [" &
ConvertToString(local_tz.StandardName()) & "]" & vbCrLf
msgtxt = msgtxt & "Standard Date [wday]: " & local_tz.StandardDate.wDay &
vbCrLf
msgtxt = msgtxt & "Standard Date [wDayOfWeek]: " &
local_tz.StandardDate.wDayOfWeek & vbCrLf
msgtxt = msgtxt & "Standard Date [wHour]: " & local_tz.StandardDate.wHour &
vbCrLf
msgtxt = msgtxt & "Standard Date [wMilliseconds]: " &
local_tz.StandardDate.wMilliseconds & vbCrLf
msgtxt = msgtxt & "Standard Date [wMinute]: " &
local_tz.StandardDate.wMinute & vbCrLf
msgtxt = msgtxt & "Standard Date [wMonth]: " & local_tz.StandardDate.wMonth
& vbCrLf
msgtxt = msgtxt & "Standard Date [wSecond]: " &
local_tz.StandardDate.wSecond & vbCrLf
msgtxt = msgtxt & "Standard Date [wYear]: " & local_tz.StandardDate.wYear &
vbCrLf

msgtxt = msgtxt & "Standard Bias: " & local_tz.StandardBias & vbCrLf

msgtxt = msgtxt & "Standard Name : [" &
ConvertToString(local_tz.DaylightName()) & "]" & vbCrLf
msgtxt = msgtxt & "GMT/UTC : " & DateAdd("n", local_tz.Bias, Now())

MsgBox msgtxt, vbInformation, "TIME STUFF"

End Sub

Private Function ConvertToString(iPoint() As Integer) As String

    Dim count As Integer

    ConvertToString = ""
    count = 0
    Do While iPoint(count)
        ConvertToString = ConvertToString & Chr(iPoint(count))
        count = count + 1
    Loop

End Function


Quote:
> I am using ADo in VB6.0 & database is oracle8.0. I have to select the

records from database where time=user input time. The user will enter the
time in PST/PDT.
Quote:
> I need to take the time interval of 30 mins if user enters the datetime,

03/23/01 23:05:00 then it should returns all the records from database
within nearest 30 min interval. All the data  in database is in GMT time.
This input time should first cahge to GMT time & then rounds to nearest time
interval. It is really complicated.
Quote:

> Any idea how to do coding for this.
> Any help in this regard will bw appreciated.

> Thanks

> Mamta

> _______________________________________________
> Submitted via WebNewsReader of http://www.interbulletin.com



Sat, 13 Sep 2003 17:40:55 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. converting PST/PDt time to GMT

2. howDoI convert a time from GMT to PST

3. How to Convert GMT(Greenwich) Time to short date and time and vice versa

4. Convert time to GMT

5. Convert time to GMT

6. Help :convert current time to GMT

7. Converting Times to GMT

8. How to convert local time to GMT?

9. Formatting Time to GMT when current Time Zone not known

10. Function to return CST time given GMT time?

11. help how to convert time string into time format

12. medium time automatically converted to long time.

 

 
Powered by phpBB® Forum Software