ComponentOne True DBInput Pro 8.0
Tutorial 15 - Working with Time Zones

This tutorial shows how to work with time zones with the TDBTZoneX object.

  1. Start a new project.

  2. From the Visual Basic Project menu, select References, then check the box labeled ComponentOne True DBZoneX 8.0 Click OK to add the TDBTZoneX object to the project.

  3. Place a ListBox (lstDetail) on the form (Form1) as shown in the following figure.

  4. We will use code to calculate the financial information that is displayed to the ListBox.

    Example Title
    Copy Code
    Private Sub Form_Load()
    
        Dim objTZ   As New TDBTZoneX6Lib.tdbTZoneX
    
        Dim NewYork As TDBTZoneX6Lib.DSTStyle
    
        Dim srcDate As Variant
    
        Dim retDate As Variant
    
     
    
        Set NewYork = objTZ.DSTStyles.Add(, "NY", "New York")
    
     
    
        ' Setting up the style attributes.
    
        With NewYork
    
            .EndDay = 0
    
            .EndMonth = dbiOctober
    
            .EndWeekday = dbiSunday
    
            .EndWhichWeek = dbiLastInMonth
    
            .EndTime = 120
    
     
    
            .StartDay = 0
    
            .StartMonth = dbiMarch
    
            .StartWeekday = dbiSunday
    
            .StartWhichWeek = dbi1stInMonth
    
            .StartTime = 120
    
            .TimeOffset = 60
    
        End With
    
        srcDate = "1999/08/15 09:00:00"
    
        lstDetail.AddItem "Tokyo time: " & srcDate
    
     
    
        ' Calculating time difference between Tokyo and New York.
    
        retDate = objTZ.WorldTimeCalc(srcDate, dbiTokyo, , dbiEastern, NewYork)
    
        lstDetail.AddItem "New York time: " & retDate
    
    End Sub
    

Run the program and observe the following:

The output is the current date and time in New York and Tokyo, each in a different format.

This concludes Tutorial 15.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback