编个winsock程序将时间发送到服务器上服务器将接收到的时间设定为系统时间

解决方案 »

  1.   

    net Time \\ServerComputername
      

  2.   

    如果是数据库的话,可以用SQL语言
      

  3.   

    在服务器端用Time   得到时间!然后送到客户端!
      

  4.   

    如SSsoft(恒谦)所說在DOS窗口中可得,如果是SQL語句用
    Select getdate()
      

  5.   

    使用api函数,添加一个窗体,在上面画一个按钮,然后添加如下代码Private Declare Function NetRemoteTOD Lib "Netapi32.dll" (yServer As Any, pBuffer As Long) As Long
    Type TIME_OF_DAY_INFO
        elapsedt As Long
        msecs As Long
        hours As Long
        mins As Long
        secs As Long
        hunds As Long
        timezone As Long
        tinterval As Long
        day As Long
        month As Long
        year As Long
        weekday As Long
    End Type
    Dim Tod1 As TIME_OF_DAY_INFO
     
    Private Sub Command1_Click()
        Dim rc As Long
        rc = NetRemoteTOD("ServerName", Tod1)
        Dim yourTime As Long
        yourTime = Tod1.hours '当前的小时数0-23
        yourTime = Tod1.mins  '当前的分钟数0-59
        yourTime = Tod1.secs  '当前的秒数0-59
    '以此类推还有tod1.day,Tod1.month,Tod1.year,Tod1.weekdayEnd Sub