1

I have a field in MySQL as varchar and need to do a select with a range. The date is in the following format "%m/%d/%Y" (Ej. 10/14/2010).

3
  • Why dont you use cast or convert varchar to date format and compare? Commented Oct 14, 2010 at 16:58
  • Why are you storing a date as a varchar? If it was stored as a proper date field you could use a normal 'BETWEEN' or equality testing. Commented Oct 14, 2010 at 16:58
  • Change this field type to DATE (and data itself accordingly). That's the only proper solution Commented Oct 14, 2010 at 16:59

1 Answer 1

2

Use str_to_date

SELECT STR_TO_DATE(dateColumnName,'%m/%d/%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.