BrainDump
  Home arrow BrainDump arrow VBScript Date Functions
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? 
BRAINDUMP

VBScript Date Functions
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    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


    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...
       · Need a printer-friendly version of the page!
     

    BRAINDUMP ARTICLES

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





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