欢迎来到山村网

VBS实现将当前时间转换成UTC时间

2019-03-02 12:53:17浏览:596 来源:山村网   
核心摘要:  这篇文章主要介绍了VBS实现将当前时间转换成UTC时间,十分的简单实用,需要的朋友可以参考下  例如下面的代码在当前时间返

  这篇文章主要介绍了VBS实现将当前时间转换成UTC时间,十分的简单实用,需要的朋友可以参考下

  例如下面的代码在当前时间返回:1368299689

  ?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Option Explicit Dim dtmDate If Wscript.Arguments.Named.Count > 0 Then Syntax With Wscript.Arguments.Unnamed ' Check command line arguments If .Count = 0 Then dtmDate = Now If .Count > 0 Then dtmDate = .Item(0) If .Count > 1 Then dtmDate = dtmDate & " " & .Item(1) If .Count > 2 Then dtmDate = dtmDate & " " & .Item(2) If .Count > 3 Then Syntax On Error Resume Next dtmDate = CDate( dtmDate ) If Err Then On Error Goto 0 Syntax End If On Error Goto 0 If Not IsDate( dtmDate ) Then Syntax End With ' Calculate and display the result Wscript.Echo DateDiff( "s", "1970-01-01 00:00:00", dtmDate ) Sub Syntax Wscript.Echo vbcrlf _ & "Date2UTC.vbs, Version 1.00" _ & vbCrLf _ & "Convert any date/time to Unix time (UTC)" _ & vbCrLf & vbCrLf _ & "Usage: Cscript.EXE //NoLogo Date2UTC.vbs date [ time ]" _ & vbCrLf & vbCrLf _ & "Where: ""date"" is the date to convert (default: current date/time)" _ & vbCrLf _ & " ""time"" is the optional time to convert" _ & vbCrLf & vbCrLf _ & "Notes: Though often called UTC, Unix time does not take into account leap" _ & vbCrLf _ & " seconds, while ""official"" UTC does." _ & vbCrLf _ & " If the specified date is ambiguous, the current user's date" _ & vbCrLf _ & " and time format is assumed." _ & vbCrLf & vbCrLf _ & "Written by Rob van der Woude" _ & vbCrLf _ & "http://www.robvanderwoude.com" Wscript.Quit 1 End Sub

  以上所述就是本文的全部内容了,希望大家能够喜欢。

(责任编辑:豆豆)
下一篇:

VBS显示当前标准时间

上一篇:

Python中处理字符串之endswith()方法的使用简介

  • 信息二维码

    手机看新闻

  • 分享到
打赏
免责声明
• 
本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们 xfptx@outlook.com