Export (0) Print
Expand All
2 out of 7 rated this helpful - Rate this topic

Working with Dates and Times

Microsoft® Windows® 2000 Scripting Guide

Dates and times play important roles in system administration. For example, when working with event logs you will often want to extract a set of records based on a specific time period (all the events that occurred yesterday, all the events that occurred last week, all the events that occurred last month). To determine such things as service reliability, you need to take the date and time a service started and the date and time the service stopped, and then use the difference to calculate the service uptime. To ensure that your scripts are running as scheduled, you need to log the date and time that a script ran and the date and time that it finished. It is difficult to underestimate the importance of dates and times in managing your computing infrastructure.

VBScript provides several different ways for you to retrieve date and time values. It also provides several methods for performing date arithmetic that is, calculating such things as the amount of time that elapsed between two events or determining whether the date 180 days from today falls on a weekend.

Note

  • The date and time formats used in VBScript are very different from the date and time formats used in WMI. For information about the WMI date and time formats and how they can be converted to the VBScript format, see "WMI Scripting Primer" in this book.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.