Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Convert WMI dates to standard dates and times?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,51327
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Convert WMI dates to standard dates and times?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Convert WMI dates to standard dates and times? - 8/29/2007 2:42:28 PM   
  puffdaddy411

 

Posts: 1
Score: 0
Joined: 8/29/2007
Status: offline
Hello all! 

I am somewhat a beginner.  I have a script that will return certain aspects of scheduled tasks on a PC.  The returned format of the date is in CIM datetime.  I should be able to use the SWbemDateTime to change the format to a simple normal format.  However, this does not work on Windows 2000 (which is what we have at the office).  Here is my code.


      

The "objJob.StartTime" returns the long string of characters such as "********230000.000000-300".  Is there a way to do this for Windows 2000? 

The description from MSDN for SWbemDateTime states I need to write my own code...so there has to be some way.  Thanks for your help!!!!! 



http://msdn2.microsoft.com/en-us/library/aa394590.aspx
quote:

 
Use the SWbemDateTime object to convert these to regular dates and times.

Windows 2000, Windows NT, and Windows 98/95:  SWbemDateTime is not available. To convert WMI dates to FILETIME or VT_DATE format or to parse the date into component year, month, day, hours, and so on, you must write your own code.


 
 
Post #: 1
 
 RE: Convert WMI dates to standard dates and times? - 8/30/2007 12:56:29 AM   
  dm_4ever


Posts: 2723
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
This article has an example that should work on 2K.  http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept04/hey0907.mspx

Also, the example you posted is simply showing a time and not really a date and time like other WMI classes show.  If you want more examples search for UTC which is the format used.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to puffdaddy411)
 
 
Post #: 2
 
 RE: Convert WMI dates to standard dates and times? - 8/30/2007 1:40:53 AM   
  CaffeineAddiction

 

Posts: 144
Score: 0
Joined: 2/9/2005
From:
Status: offline
Not going to write it for you, but when you go to write this your going to need the mid() , left() , len() functions

also remember you can used these functions inside of eachother ... for example left(string,len(string)-3)

< Message edited by CaffeineAddiction -- 8/30/2007 1:43:33 AM >


_____________________________

Thanks for Answering my Questions ... I hope my Answer to your questions help!

(in reply to dm_4ever)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Convert WMI dates to standard dates and times? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts