>Thank a lot. This one is works as well as without '^'.
This VB.NET function converts a date format for a SQL command into a format as per the backend. It might be useful to you. This can be easily adapted in the environment of your choice. The code is pretty straight forward. Usually, I will build my SQL like this:
lcSQL="SELECT Member.FirstName FROM Member WHERE Member.AddDate>="+DateUniversal(Date.Now,1)
' Return a date in a universal format
' expD1 Date
' expN1 Backend
Public Function DateUniversal(ByVal tdDate As Date, ByVal tnBackend As Integer) As String
Dim lcDate As String = ""
Dim lnDay As Integer = 0
Dim lnHour As Integer = 0
Dim lnMinute As Integer = 0
Dim lnMonth As Integer = 0
Dim lnSecond As Integer = 0
Dim lnYear As Integer = 0
lnDay = tdDate.Day
lnMonth = tdDate.Month
lnYear = tdDate.Year
lnHour = tdDate.Hour
lnMinute = tdDate.Minute
lnSecond = tdDate.Second
' Different backends handle it differently
Select Case tnBackend
' Visual FoxPro
Case 1
lcDate = lcDate + "{^"
lcDate = lcDate + Trim(lnYear.ToString) + "/" + lnMonth.ToString.PadLeft(2, "0") + "/" + _
lnDay.ToString.PadLeft(2, "0") + " " + lnHour.ToString.PadLeft(2, "0") + ":" + _
lnMinute.ToString.PadLeft(2, "0") + ":" + lnSecond.ToString.PadLeft(2, "0")
lcDate = lcDate + "}"
' SQL Server
Case 2
lcDate = lcDate + "'"
lcDate = lcDate + lnMonth.ToString.PadLeft(2, "0") + "/" + lnDay.ToString.PadLeft(2, "0") + "/" + _
Trim(lnYear.ToString) + " " + lnHour.ToString.PadLeft(2, "0") + ":" + _
lnMinute.ToString.PadLeft(2, "0") + ":" + lnSecond.ToString.PadLeft(2, "0")
lcDate = lcDate + "'"
End Select
Return lcDate
End Function