BrainDump
  Home arrow BrainDump arrow Page 3 - VBScript: More Fun with the 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: 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
     
     
    ADVERTISEMENT


    VBScript: More Fun with the Date Functions - Serial Dating


    (Page 3 of 6 )

    The DateSerial...well it's hard to explain exactly what it does, so I am just going to show you. The syntax is DateSerial(year,month,day). Here we go:


    <html>

    <body>

    <script type="text/vbscript">

    document.write("I was born on: ")

    document.write(DateSerial(1977,4,22) & "<br /")

    </script>

    </body>

    </html>

    Which results in:

      I was born on: 4/22/1977

    You can also do this:


    <html>

    <body>

    <script type="text/vbscript">

    document.write("I was born on: ")

    document.write(DateSerial(2007-30,12-8,4+18) & "<br /")

    </script>

    </body>

    </html>

    This also results in:

      I was born on: 4/22/1977

    Valuing Your Date

    The DateValue returns a value that is a Date type. Here it is in action:


    <html>

    <body>

    <script type="text/vbscript">

    document.write(DateValue("28-Nov-07") & "<br />")

    document.write(DateValue("28-Nov"))

    </script>

    </body>

    </html>

    The result:

      11/28/2007

      11/28/2007

    You will note that if you leave the year portion out of the statement, it will use the systems year.

    More BrainDump Articles
    More By James Payne


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

    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
    Stay green...Green IT