BrainDump
  Home arrow BrainDump arrow Page 5 - VBScript: More Fun with the Date Functions
Iron Speed
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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Developerworks
 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? 
BRAINDUMP

VBScript: More Fun with the Date Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-03-25

    Table of Contents:
  • VBScript: More Fun with the Date Functions
  • Parsing out the Month, Day, and Year from the Current Date:
  • Serial Dating
  • What Day is it Anyway?
  • Day, Month, Year, Hour, Minute, Second
  • Figuring Out Which Month it is

  • 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
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    VBScript: More Fun with the Date Functions - Day, Month, Year, Hour, Minute, Second
    (Page 5 of 6 )

    The following script displays the Day, Month, Year, Hour, Minutes, and Second using each unit's respective function:


    <html>

    <body>

    <script type="text/vbscript">

    document.write("The Month's number is: ")& (Month(Date))

    document.write("<br />")

    document.write("The Day is: ")& (Day(Date))

    document.write("<br />")

    document.write("The Year is: ")& (Year(Date))

    document.write("<br />")

    document.write("The hour is: ")& (Hour(Time))

    document.write("<br />")

    document.write("The minute is: ")& (Minute(Time))

    document.write("<br />")

    document.write("The second is: ")& (Second(Time))

    </script>

    </body>

    </html>

    The result of this code follows:

      The Month's number is: 12
      The Day is: 28
      The Year is: 2007
      The hour is: 8
      The minute is: 48
      The second is: 42

    The IsDate() Function

    The IsDate() function is used to determine whether a particular expression can be converted into a date. Since the function returns a Boolean result, if the value can indeed be converted, a TRUE result is returned. If it cannot, then a FALSE is returned.

    Here is the code in all its glory:


    <html>

    <body>

    <script type="text/vbscript">

    document.write(IsDate("October 31, 2008") & "<br />")

    document.write(IsDate("I eat Biscuits Yum") & "<br />")

    document.write(IsDate(#10/31/08#) & "<br />")

    document.write(IsDate("12/13/2008"))

    </script>

    </body>

    </html>

    This returns the following results:

      True
      False
      True
      True

    More BrainDump Articles
    More By James Payne


       · Welcome back to our continuing discussion on VBScript date functions. Here we learn...
     

    BRAINDUMP ARTICLES

    - Handling Multiple Contracts with Indigo
    - Cleaning Out Your Data in XP
    - Multiple Service Contracts and Indigo
    - Cleaning Out Your Programs in XP
    - Handling Metadata with Indigo
    - Building Blocks for a WCF Service Web Site
    - Help! I Need Some Remote Assistance
    - Using Service Templates with Indigo
    - Windows XP Tips for Task Manager
    - Generating Clients and Services with Indigo
    - Vista SP1, A Review
    - Services and the WCF
    - VBScript: Final Date Functions
    - Creating Services with the WCF
    - The Resource View of the MFC

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway