Windows Scripting
  Home arrow Windows Scripting arrow Working With Dates and Times in VBScript
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Working With Dates and Times in VBScript
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-01-20

    Table of Contents:
  • Working With Dates and Times in VBScript
  • Retrieving the date and time
  • Working with date and time parts
  • Assigning Date values
  • Performing calculations
  • Date formats

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Working With Dates and Times in VBScript


    (Page 1 of 6 )

    VBScript provides a wide variety of support for working with dates and times. It offers a number of different functions geared toward retrieving the current date and time, calculating past and future dates and times, and comparing dates and times.

    Since there are so many functions available, the key to learning and use them all is to break them down into groups based on what they do.  This simplified approach will help you to remember them more easily.

    It’s important to understand that VBScript treats dates and times as a numeric sub-type and provides an actual data type for them.  This allows VBScript to perform date and time calculations more easily.

    Dates and times in VBScript are handled according to the VT_Date specification.  Among other things, this determines the range of dates that VBScript will accept, the precision of those dates and times, and the manner in which they are handled internally.  This also means that dates and times are based upon the system clock as well as the current system’s regional date and time settings.  Scripters should be aware that this creates inherent flaws when working with dates and times from remote systems and when performing calculations on dates and times that span multiple time zones.

    Finally, scripters should also be aware that VBScript will support nearly every acceptable date and time format.  This means that scripts written in different areas of the world may look very different.  You should know your intended audience very well when implementing dates and times in your scripts.  For instance, does your target audience use a 12 or 24-hour clock?  Do they list dates with the month or day first?  What language are weekday and month names in?  Is Sunday the first day of the week or do they use a completely different calendar altogether?

    More Windows Scripting Articles
    More By Nilpo


     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek