BrainDump
  Home arrow BrainDump arrow VBScript 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 
 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 Date Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2008-01-07

    Table of Contents:
  • VBScript Date Functions
  • Functioning it Up with CDate
  • Working with the Date Function
  • The Vainglorious DateDiff Function

  • 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

    Ajax Application Generator Generate database 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 Date Functions
    (Page 1 of 4 )

    In our previous article we talked about loops and touched briefly upon creating your own functions. As you know, VBScript comes packed with its own pre-defined functions (like our buddy document.write), and in this article we are going to cover most, if not all, of the Date Functions. There are quite a few, so let's get started.

    Before we dive in, here is a table showing the various Date Functions:

     

    Function Name

    What It Does

    CDate

    Used to change the date and time expression to the variant subtype Date.

    Date

    Used to return the current date, based on your system date.

    DateAdd

    Used to return a date in which a time interval you specified has been added.

    DateDiff

    Used to return the difference between two dates.

    DatePart

    Used to return a specific part of a date.

    DateSerial

    Used to return the date for a year you specify: year, month, and day.

    DateValue

    Used to return a date.

    Day

    Used to return a day of the month; returns a number between 1 and 31.

    FormatDateTime

    Used to return an expression. Formats it as a date or as a time.

    Hour

    Used to return the hour. Returns a number between 0 and 23.

    IsDate

    Used to check if a value can be converted to a date. Returns a boolean value.

    Minute

    Used to return the minutes of an hour. Value range is between 0 and 59.

    Month

    Returns the month. Value returned is a number ranging from 1-12.

    MonthName

    Returns the name of a month you specifiy.

    Now

    Returns the date and time based on your system's date and time.

    Second

    Returns the seconds of the minute. Returns a value between 0 and 59.

    Time

    Used to return the system time.

    Timer

    Used to return the amount of seconds since 12:00 am.

    TimeSerial

    Used to return the time for a specified hour, minute, and second.

    TimeValue

    Used to return a time.

    Weekday

    Used to return a day of the week. Value is a number between 1 and 7

    WeekDayName

    Used to return the name of a day in the week.

    Year

    Used to return a year. Value is a number representing the year. (Duh)

    More BrainDump Articles
    More By James Payne


       · Thanks for stopping by. In this article we discuss Date Functions in VBScript, like...
     

    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 1 hosted by Hostway