Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
  2. ' Construct a datetime value using the intrinsic VB CDate object,
  3. ' interpreting this as a local date/time (and assume we run this in
  4. ' the Pacific time zone when it is 8 hours behind GMT).
  5. dateTime.SetVarDate (CDate ("January 20 11:56:32"))
  6. ' Will display as 20000120195632.000000-480. This is the equivalent time
  7. ' in GMT with the specified offset for PST of �8 hours.
  8. WScript.Echo dateTime
  9. ' Will display as 1/20/2000 11:56:32 AM. This is because we asked for a
  10. ' local time.
  11. WScript.Echo
  12. WScript.Echo "As Local"
  13. WScript.Echo "--------"
  14. WScript.Echo dateTime.GetVarDate
  15. WScript.Echo dateTime.GetFileTime ()
  16. ' Will display as 1/20/2000 7:56:32 PM. This is because we asked for a
  17. ' non-local time.
  18. WScript.Echo
  19. WScript.Echo "As UTC"
  20. WScript.Echo "------"
  21. WScript.Echo dateTime.GetVarDate (false)
  22. WScript.Echo dateTime.GetFileTime (false)
  23. WScript.Echo
  24. WScript.Echo "Loss of Precision"
  25. WScript.Echo "-----------------"
  26. dateTime.SetFileTime "126036951652031269"
  27. WScript.Echo dateTime.GetFileTime
  28. WScript.Echo "126036951652031269"