zoukankan      html  css  js  c++  java
  • 如何获取电脑操作系统的时区

    vba通过API函数获取电脑操作系统的时区。

    #If Win64 Then
        Private Declare PtrSafe Sub GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION)
    #Else
        Private Declare Sub GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION)
    #End If
    Private 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
     
    Private 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
     
    Sub xx()
    Dim b As TIME_ZONE_INFORMATION Dim Zone As Integer GetTimeZoneInformation b Zone = b.Bias / 60 MsgBox Zone End Sub

    结果返回-8,表示世界时间比中国时间晚8小时,即所在时区位于东八区。

  • 相关阅读:
    最小瓶颈路
    HASH处理KMP算法
    忠诚
    程序自动分析
    图书管理
    银牛派对
    平均数
    抓住那头牛
    P2135 方块消除
    CSPS前最后一次模拟赛----爆炸的全过程
  • 原文地址:https://www.cnblogs.com/FanXiaoLei/p/13098757.html
Copyright © 2011-2022 走看看