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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle VB date probs 2

Status
Not open for further replies.

Bastien

Programmer
Joined
May 29, 2000
Messages
1,683
Location
CA
Hi All,

I have a date field that is input by the user which I need to convert to match a SQL expression later. The oracle DB expects the date as:

...= TO_DATE ('" & dteDate & "', 'DD-MON-YYYY') AND"


dteDate = txtDate.Text
dteDate = Format(dteDate, "dd-mmm-yyyy")

yet the date keeps not formatting at all...when I capture the sql statement, I get this:

...= TO_DATE ('2/22/02', 'DD-MON-YYYY')
when what I want is:
...= TO_DATE ('22-FEB-2002', 'DD-MON-YYYY')

any ideas?

TIA

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
I am assuming that you have defined dteDate as Date. The format you are seeing (2/2/02) is the systems date format. The format function formats a string. You need to change this to a string.

Dim dtedate As String
dtedate = "2/2/02"
dtedate = Format(dtedate, "dd-mmm-yyyy")
 
that was it...thanks Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top