Free web development scripts for the webmasterDevelopment Scripts


 social media marketing services
 Site Navigation
Clicky Web Analytics
 o Development Scripts
 o Text Only Edition
 o PHP.net News
 o Tutorials
 o Register an account
 o New entries this week
 o Affiliates/Links
 o Contact Us
 o About us
 o Advanced Search

 Browse Path
 o 1 user online
 o Most users online: 67
 o Home
  o ASP
   o Miscellaneous
    o Script

 Member Login
User Name
Password

 Standards
Valid XHTML 1.0!
Valid 
CSS!

 Recommended Links
 o PHP Freaks
 o Paper Free Invoicing
 o Tutorials
 o Expired Domain Crawler

Effectively format dates and times with ASP (Rated 0)

Description:

Formatting the date and time into a specific format can be important, especially for posting to a database and for consistency. VBScript has a built in function called "FormatDateTime" which combined with a value for the type of date or time, can "prepare" the field for accuracy before it gets put into a database field.

There are 5 constants with associated values that can be used. 0 is vbGeneralDate, 1 is vbLongDate, 2 is vbShortDate (00/00/00), 3 is vbLongTime and 4 is vbShortTime. 1, 2 and 3 are dependent on your local machines locale settings (or regional settings) which are set in your machines control panel under "Regional Settings". As shown below, the numbers are defined after the date/time or a variable containing a date time, separated with a comma.

Code starts here


'Formatting date and time with FormatDateTime

dim strDate
dim strFormTime

strFormTime = Request.Form("time")

strDate = FormatDateTime(12-apr-02, 2)

'or via form input

strFormTime = FormatDateTime(strFormTime, 3)


Submitted by Devscripts on 13-02-2003 20:07


Recent Additions (from all categories)

(PHP) T Shirt Printing Software

(PHP) Youtube Video Organizer Script

(PHP) MP3z - MP3 Search Engine Script

(PHP) Recipez- PHP Recipe Script

(ASP) Stop image hotlinking and downloading. Web image protection is easy with Image Trapper.

Top Rated Scripts

(Javascripts) Javascript Delayed Redirection Rating: 5

(PHP) Random Links and images with PHP & MySQL Rating: 5

(PHP) RSS/XML news feed headline grabber! Rating: 5

(PHP) Random Signatures/Avatars Rating: 5

(Javascripts) Detecting Client Web Browser Rating: 5

© Copyright 2003 - Devscripts.net  Web Analytics