Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting US Date to UK Date 1

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
i need change the Date Format from US to UK(using Brinkster), i have this function


USDate = news("data")

Function UStoUK(USDate)

Dim UKDay
Dim UKMonth
Dim UKYear
Dim UKDate

UKYear = right(USDate,4)

Dim lengthDate

lengthDate = len(USdate)


Select Case int(lengthDate)
Case 8
'0/0/0000
UKMonth = left(date,1)
UKDay = left(right(date,6),1)

Case 9
'00/0/0000
if left(right(date,1),3) = "/" then
UKMonth = left(date,2)
UKDay = left(right(date,6),1)

else
'0/00/0000
UKMonth = left(date,1)
UKDay = left(right(date,7),2)

end if

Case 10
'00/00/0000
UKMonth = left(date,2)
UKDay = left(right(date,7),2)

End Select

UKDate = UKDay & "/" & UKMonth & "/" & UKYear

Response.Write(UKDate)

End Function
%>


and i'm getting an error

Microsoft VBScript compilation error '800a03ea'

Syntax error

/votos/convDate.asp, line 13

Function UStoUK(USDate)
^
can anyone tell me what's wrong?
 
USDate = news("data")

Function UStoUK(USDate)

Dim UKDay
Dim UKMonth
Dim UKYear
Dim UKDate

UKYear = right(USDate,4)

Dim lengthDate

lengthDate = len(USdate)


Select Case int(lengthDate)
Case 8
'0/0/0000
UKMonth = left(date,1)
UKDay = left(right(date,6),1)

Case 9
'00/0/0000
if left(right(date,1),3) = "/" then
UKMonth = left(date,2)
UKDay = left(right(date,6),1)

else
'0/00/0000
UKMonth = left(date,1)
UKDay = left(right(date,7),2)

end if

Case 10
'00/00/0000
UKMonth = left(date,2)
UKDay = left(right(date,7),2)

End Select

UKDate = UKDay & "/" & UKMonth & "/" & UKYear

UStoUK = UKDate

End Function


Response.Write (UStoUK("xx/xx/xx"))

%> www.vzio.com
ASP WEB DEVELOPMENT



 
what do you mean with "xx/xx/xx"
 
or the string of your US Date, thats the format of your date you are changing to UK... www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top