Format Function:

The Format function formats a number, date or time based on the user entered format type. There are two required statements: expression and format. Expression represents the number, date or time you are trying to format. The format argument tells the system how to display the input expression. Acceptable values for the format argument are: Short Time, Long Time, Short Date, Long Date, General Date, General Number, Currency, Fixed, Standard, Percent, Yes/No, True/False, or On/Off.

Syntax:
string = Format(expression, format)
Example Usage:
<%
 ' declare and set variables
dim num, datetime
num = 1741534.542058484
datetime = Now()
%>
Short Time:
<% = Format( datetime, "Short Time" ) %><BR>
Long Time:
<% = Format( datetime, "Long Time" ) %><BR>
Short Date:
<% = Format( datetime, "Short Date" ) %><BR>
Long Date:
<% = Format( datetime, "Long Date" ) %><BR>
General Date:
<% = Format( datetime, "General Date" ) %><BR>
General Number:
<% = Format( num, "General Number" ) %><BR>
Currency:
<% = Format( num, "Currency" ) %><BR>
Fixed:
<% = Format( num, "Fixed" ) %><BR>
Standard:
<% = Format( num, "Standard" ) %><BR>
Percent:
<% = Format( num, "Percent" ) %><BR>
Yes/No:
<% = Format( num, "Yes/No" ) %><BR>
True/False:
<% = Format( num, "True/False" ) %><BR>
On/Off:
<% = Format( num, "On/Off" ) %><BR>
ASP Source Code:
<%
Private Function Format(byVal expression, byVal strFormat)
	On Error Resume Next
	Select Case lcase( strFormat )
		Case "general date"
			Format = FormatDateTime(expression, 0)
		Case "long date"
			Format = FormatDateTime(expression, 1)
		Case "short date"
			Format = FormatDateTime(expression, 2)
		Case "long time"
			Format = FormatDateTime(expression, 3)
		Case "short time"
			Format = FormatDateTime(expression, 4)
		Case "general number"
			Format = Replace( expression, ",", "" )
		Case "currency"
			Format = FormatCurrency(expression, 2)
		Case "fixed"
			Format = Replace( FormatNumber(expression, _
				 2, -1), ",", "" )
		Case "standard"
			Format = FormatNumber(expression, 2, -1)
		Case "percent"
			Format = FormatPercent(expression, 2)
		Case "yes/no"
			expression = cLng(expression)
			If expression = 0 then 
				Format = "No" 
			else 
				Format = "Yes"
			end if
		Case "true/false"
			expression = cLng(expression)
			If expression = 0 then 
				Format = "False" 
			else 
				Format = "True"
			end if
		Case "on/off"
			expression = cLng(expression)
			If expression = 0 then 
				Format = "Off" 
			else 
				Format = "On"
			end if
		Case Else
			Format = expression
	End Select
	On Error GoTo 0
End Function
%>
See It Work