国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 常宁市| 灵丘县| 辽阳县| 获嘉县| 大姚县| 嵩明县| 正镶白旗| 尚志市| 雅安市| 许昌市| 六枝特区| 盐池县| 绥芬河市| 和林格尔县| 万荣县| 全椒县| 平山县| 儋州市| 平定县| 金山区| 孟州市| 和平县| 和政县| 阜阳市| 宜兰县| 延吉市| 凌海市| 额济纳旗| 庆安县| 彩票| 六盘水市| 凤阳县| 砚山县| 达拉特旗| 澄江县| 平潭县| 临沭县| 光山县| 宜昌市| 镇平县| 临泉县|