VBS实现将当前时间转换成UTC时间
导读:收集整理的这篇文章主要介绍了VBS实现将当前时间转换成UTC时间,觉得挺不错的,现在分享给大家,也给大家做个参考。 例如下面的代码在当前时间返回:1368299689Option Exp...
收集整理的这篇文章主要介绍了VBS实现将当前时间转换成UTC时间,觉得挺不错的,现在分享给大家,也给大家做个参考。 例如下面的代码在当前时间返回:1368299689
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 SyntaxEnd With ' Calculate and display the resultWScript.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 1End Sub以上所述就是本文的全部内容了,希望大家能够喜欢。
您可能感兴趣的文章:- 用vbscript实现修改屏幕保护的等待时间长度
- 将WMI中的DateTime类型转换成VBS时间的函数代码
- 用VBS修改(设置)系统时间和日期的代码
- 校准系统时间的VBS代码
- VBS中获取系统本次及上次开关机时间的代码(WinXP/win2003/Win7兼容版)
- vbscript实现的根据不同时间段显示不同的欢迎语
- vbs获取当前时间日期的代码
- vbscript获取文件的创建时间、最后修改时间和最后访问时间的方法
- VBS显示当前标准时间
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: VBS实现将当前时间转换成UTC时间
本文地址: https://pptw.com/jishu/610094.html
