SwapDate

Changes date format from US to International or from international to 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.

Function SwapDate(dateinput)
 Dim strWorkingDate, tmpArray, assemblystring, del, i
 strWorkingDate   = dateinput
 if instr(strWorkingDate, "/") Then
  del      = "/"
 elseif instr(strWorkingDate, "-") Then
  del      = "-"
 elseif instr(strWorkingDate, " ") then
  del      = " "
 end if
 tmpArray     = split( strWorkingDate, del )
 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

dateinput

mm-dd-yy (US) is converted to dd-mm-yy (Int&#39;l). <br/>dd/mm/yy (Int&#39;l) to mm-dd-yy (US). <br/>January 4, 2000 to 4 January, 2000 and vice versa

Views 1018 Downloads 337

'date us format', 'international format', 'convert', 'replace', 'change'

ANmarAmdeen
333
Date+Time Classic ASP
Revisions

v1.0