Groups > Asp .Net > Advanced ASP.NET SQL Server Reporting Services > Re: Converting US Date To UK Date in Reporting Services




Converting US Date To UK Date in Reporting Services

Converting US Date To UK Date in Reporting Services
Tue, 9 May 2006 11:20:19 +0000
I am using thise function in the Code Properties of my Report to convert US Date
formats to UK Date format :

 

Public Function ConvertUSDateToUKDate(ByVal strUSDate As Object) As String 
 Dim strDay As String = strUSDate.Substring(3, 2) 
 Dim strMonth As String = strUSDate.Substring(0, 2) 
 Dim strYear As String = strUSDate.Substring(6, 4) 
 Dim strUKDate As String = strDay + "/" + strMonth + "/" +
strYear + strUSDate.Substring(10, 12) 
 Return strUKDate 
End Function

I keep getting an error with it, I'm not sure whether it is a VB.NET code error,
or a Reporting Services error.  Can anybody help?

 

Cheers,

Mike
Post Reply
Re: Converting US Date To UK Date in Reporting Services
Tue, 9 May 2006 15:17:00 +0000
Sorted this out :

Public Function ConvertUSDateToUKDate(ByVal strUSDate As String) As String 
 Dim strUKDate As String = "" 
 If Not (strUSDate = "") Then 
   Dim arrRateArray As String() 
   Dim arrSeparator As Char() = {"/"C} 
   arrRateArray = strUSDate.Split(arrSeparator) 
   Dim strMonth As String = arrRateArray(0) 
   Dim strDay As String = arrRateArray(1) 
   Dim strYear As String = arrRateArray(2).Substring(0, 4) 
   Dim strTime As String = arrRateArray(2).Substring(5, arrRateArray(2).Length -
5) 
   strUKDate = strDay + "/" + strMonth + "/" + strYear +
" " + strTime 
 Else 
   strUKDate = "" 
 End If
Post Reply
about | contact