国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > VBScript > 正文

VBS實(shí)現(xiàn)將當(dāng)前時(shí)間轉(zhuǎn)換成UTC時(shí)間

2020-06-26 18:31:21
字體:
供稿:網(wǎng)友

這篇文章主要介紹了VBS實(shí)現(xiàn)將當(dāng)前時(shí)間轉(zhuǎn)換成UTC時(shí)間,十分的簡(jiǎn)單實(shí)用,需要的朋友可以參考下

例如下面的代碼在當(dāng)前時(shí)間返回:1368299689

 

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

以上所述就是本文的全部?jī)?nèi)容了,希望大家能夠喜歡。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 乐都县| 浦江县| 宁蒗| 诸暨市| 屏东县| 衡阳市| 含山县| 三穗县| 巴林右旗| 伊春市| 朝阳市| 浮山县| 永仁县| 获嘉县| 农安县| 光山县| 晋城| 宝丰县| 莎车县| 沭阳县| 宾阳县| 和硕县| 定西市| 饶阳县| 山西省| 江达县| 公安县| 东乡县| 延寿县| 夏邑县| 叶城县| 凤冈县| 六盘水市| 利辛县| 嘉鱼县| 曲靖市| 密云县| 民勤县| 海原县| 南城县| 渝北区|