VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class

by Karthikeyan (187 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Thu 29th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class

Rate Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class



'Generated using 'WMI Win32 Class Autoscript Generator' - Developed by Karthikeyan
'Homepage: http://www.geocities.com/marskarthik

On Error Resume Next
Computer = "."
Set OutFile = CreateObject("WScript.Shell")
Const ForAppending = 2
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set TextFile = FileSystem.OpenTextFile ("c:\Win32_CurrentTime.txt", ForAppending, True)
TextFile.WriteLine "Script for Win32_CurrentTime Class by Karthikeyan"
TextFile.WriteLine 
Set WMIService = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
Set Items = WMIService.ExecQuery("Select * from Win32_CurrentTime",,48)
For Each SubItems in Items
TextFile.WriteLine "********************************************************************"
    TextFile.WriteLine "Day: " & SubItems.Day
    TextFile.WriteLine "DayOfWeek: " & SubItems.DayOfWeek
    TextFile.WriteLine "Hour: " & SubItems.Hour
    TextFile.WriteLine "Milliseconds: " & SubItems.Milliseconds
    TextFile.WriteLine "Minute: " & SubItems.Minute
    TextFile.WriteLine "Month: " & SubItems.Month
    TextFile.WriteLine "Quarter: " & SubItems.Quarter
    TextFile.WriteLine "Second: " & SubItems.Second
    TextFile.WriteLine "WeekInMonth: " & SubItems.WeekInMonth
    TextFile.WriteLine "Year: " & SubItems.Year
TextFile.WriteLine "********************************************************************"
Next
TextFile.Close
OutFile.Run "notepad.exe c:\Win32_CurrentTime.txt",1,True


Download this snippet    Add to My Saved Code

Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class Comments

No comments have been posted about Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class. Why not be the first to post a comment about Get the Current System time and Greenwich time using Win32_CurrentTime WMI Class.

Post your comment

Subject:
Message:
0/1000 characters