The VBS implementation converts the current time to UTC time

Source: Internet
Author: User
Tags current time goto

This article mainly introduces the VBS implementation to convert the current time to UTC time, very simple and practical, the need for friends can refer to the

For example, the following code returns at the current time: 1368299689

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 This is the Option Explicit   Dim dtmdate   If WScript.Arguments.Named.Count > 0 Then Syntax   with Wscript.argume Nts. 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 Erro R 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 "_ &A mp 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 (DEFA Ult:current date/time) "_ & VbCrLf _ &" "Time" "are the optional time to convert" _ & vbCrLf & VbCrLf _ & "Notes:though often called UTC, Unix time does not take to account Leap" _ & VbCrLf _ & "seconds "Official" "UTC does." _ & VbCrLf _ & "If" specified date is ambiguous, the current user ' s date ' _ & vbcr Lf _ & "and time the format is assumed." _ & VbCrLf & VbCrLf _ & "written by Rob van der Woude" _ & VBCRL F _ & "http://www.robvanderwoude.com" Wscript.Quit 1 end Sub

The above is the entire contents of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.