home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,658 of 10,840   
   Keith R. Weimer to Magnus McElroy   
   Re: vb6 UTC time?   
   18 Aug 05 19:15:29   
   
   From: KillerQ13@hotmail.com   
      
   "Magnus McElroy" <"[myfirstname]"@habitresearch.[com]> wrote in message   
   news:NyMMe.34735$vj.3766@pd7tw1no...   
   >   
   >   
   > jhLewis wrote:   
   >> Using vb6, I would like to have either a text box or label display the   
   >> current time in UTC format...I can't seem to find any instructions or   
   >> code snippets on how to accomplish it...   
   >>   
   >> Any help appreciated...thanks.   
   >>   
   >> John   
   >   
   >   
   > I used this code. I cut-and-pasted it, so help yourself.   
   >   
   > 'After this point, I cut and pasted code from a Visual Basic group to 'try   
   > and help with the timezone problem.   
   >  Const TIME_ZONE_ID_INVALID = &HFFFFFFFF   
   >  Const TIME_ZONE_ID_UNKNOWN = &H0   
   >  Const TIME_ZONE_ID_STANDARD = &H1   
   >  Const TIME_ZONE_ID_DAYLIGHT = &H2   
   >   
   >  Type TIME_ZONE_INFORMATION   
   >     Bias As Long   
   >     StandardName As String * 32   
   >     StandardDate As Long   
   >     StandardBias As Long   
   >     DaylightName As String * 32   
   >     DaylightDate As Long   
   >     DaylightBias As Long   
   >  End Type   
   >   
   >  Declare Function GetTimeZoneInformation Lib "kernel32" _   
   >   (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long   
   >   
   >  Function NowPlusTZBias() As Date   
   >   
   >     Dim usrTZI As TIME_ZONE_INFORMATION   
   >     Dim lngRetVal As Long   
   >   
   >     lngRetVal = GetTimeZoneInformation(usrTZI)   
   >     NowPlusTZBias = Now + (usrTZI.Bias / 1440)   
   >  End Function   
   >   
   > To use it in the program, do this:   
   >   
   >    'If this is true, we're using Windows Time. Note that we have to   
   >    'compenstate for the timezone and use UTC. The NowPlusTZ Biaswas   
   >    'code taken from a MS access? newsgroup.   
   >    data_out(1) = CByte(Year(NowPlusTZBias) - 2000)   
   >    data_out(2) = CByte(Month(NowPlusTZBias))   
   >    data_out(3) = CByte(Day(NowPlusTZBias))   
   >    data_out(4) = CByte(Hour(NowPlusTZBias))   
   >    data_out(5) = CByte(Minute(NowPlusTZBias))   
   >    data_out(6) = CByte(Second(NowPlusTZBias))   
   >   
   >   
   > In other words, copy the first part into your code (as I did) and instead   
   > of using Now, use NowPlusTZBias   
   >   
   > --   
   > Magnus McElroy   
   > Electrical Engineer (EIT)   
   > HABIT Research   
   > (250) 381-9425   
      
   Is there a reason why seemingly nobody used the GetSystemTime funtion and   
   does all this crazy adding and subtracting?   
      
   Keith R. Weimer   
   Way Too Happy Software   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca