SwapDate Function:

The SwapDate function changes a US format date into an Internationally formatted date and vice versa. If the input is mm-dd-yy (US) it is converted to dd-mm-yy (Int'l). If the input is dd/mm/yy (Int'l) it is converted to mm-dd-yy (US). Acceptable date input can be in short format with either a two or four digit year: mm/dd/yy, mm/dd/yyyy, dd/mm/yy, dd/mm/yyyy. Worded dates are also acceptable as input: January 4, 2000 is changed to 4 January, 2000 and vice versa. 23rd August, 2000 would be changed to August 23rd, 2000.

Syntax:
date = SwapDate(DateToSwap)
Example Usage:
<%
 ' change US date (March 1st, 2000) to Int'l (1st March, 2000)

	 ' 2 digit year
	response.write SwapDate("3/1/00") & "<BR>"
	 ' 4 digit year
	response.write SwapDate("3/1/2000") & "<BR>"
	 ' worded month, 4 digit year
	response.write SwapDate("March 1, 2000") & "<BR>"

 ' change Int'l date (31 Sept, 2000) into a US date (Sept 31, 2000)

	 ' worded month, 4 digit year
	response.write SwapDate("31 September, 2001") & "<BR>"
	 ' 4 digit year
	response.write SwapDate("30-9-2001") & "<BR>"
	 ' 2 digit year
	response.write SwapDate("31/9/01") & "<BR>"
%>
ASP Source Code:
<%
Private Function SwapDate(byVal dateinput)
	Dim strWorkingDate, tmpArray, assemblystring, del, i
	strWorkingDate = dateinput
	if instr(strWorkingDate, "/") Then
		tmpArray = split( strWorkingDate, "/" )  :  del = "/"
	elseif instr(strWorkingDate, "-") Then
		tmpArray = split( strWorkingDate, "-" )  :  del = "-"
	elseif instr(strWorkingDate, " ") then
		tmpArray = split( strWorkingDate, " " )  :  del = " "
	end if
	for i = 0 to ubound(tmpArray)
		tmpArray( i ) = replace( tmparray( i ), ",", "" )
	next
	assemblystring = tmpArray(1) & del & tmpArray(0)
	if del = " " then assemblystring = assemblystring & ","
	assemblystring = assemblystring & del & tmpArray(2)
	SwapDate = Trim( assemblystring )
End Function
%>