0

I have a query from within my vb.net code which searchs for a record by date. The date being entered via the code is in format dd/mm/yyyy, i need to search in the database using yyyy/mm/dd?

Ideally i thought there may just be a function within MySQL which will convert this. If not in vb.net to convert the string 01/01/2011 to 2011/01/01?

Thanks

1

1 Answer 1

1

Take a look at str_to_date() function

select str_to_date('01/01/2011','%d/%m/%Y')

So, your search becomes

select * from table where date_field = str_to_date(your_variable,'%d/%m/%Y')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.