Windows Scripting
  Home arrow Windows Scripting arrow Building Calendars with VBScript Date Func...
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

Building Calendars with VBScript Date Functions
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-01-26

    Table of Contents:
  • Building Calendars with VBScript Date Functions
  • Beginning the script
  • Finding the necessary dates
  • Calculating the remaining values

  • 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


    Building Calendars with VBScript Date Functions


    (Page 1 of 4 )

    Every year the Microsoft Scripting Guys host a scripting challenge known as the Microsoft Scripting Games as a sort of Olympics for Windows scripters. This past year presented an interesting challenge that provided an excellent opportunity to use some of VBScript’s Date functions that I’ve been covering in my last couple articles.

    There are probably a few different ways to accomplish the task I’ll be presenting you with, but the example you see here is my actual submission for this event.  I believe it offers a very efficient and somewhat elegant approach to the challenge.

    The challenge was simple.  Participants had to write a script capable of outputting a calendar for a specified month as in the example below.  The script had to allow a user to specify the month and year and then perform the correct calculations to produce the calendar for the given month in the given year.

       September 2008

       Sun   Mon   Tue   Wed  Thu    Fri    Sat
                1        2       3       4       5       6
         7      8       9       10     11     12     13
        14     15     16     17     18     19     20
        21     22     23     24     25     26     27
        28     29     30                           

    “What’s the point?” You ask.

    I don’t know.  Maybe you want to know on what day of the week Napoleon was born. [It was a Tuesday. --Ed.]

    While the challenge did not require the calendar to be as neatly formatted as you see above, it’s not difficult at all to add the simple padding between columns, so I saw no reason not to.  Participants were also not required to validate user input.  It was assumed that the user would only input a correct month and year.  Validation is not very hard to do.  Those who would like to add validation can learn how at the end of this article series.

    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 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek