Quote Originally Posted by si_the_geek

Oh yes you are!

To understand why, I would recommend reading this Classic VB FAQ article: Why are my dates not working properly?
As I said before - the date format settings in the database/regional settings/etc do not matter at all. What matters is the settings of the SQL language, which only accepts US or ISO formats (except for some database systems which have completely different methods, as explained the the FAQs).

As anhn explained, some systems (such as Access, and VB itself) will automatically convert the format (by switching the Month & Day parts) if the Day is larger than 12.


That means if you write code using todays date (in the format you want to use), it will appear to be fine, but if the date changes to a lower day (like at the start of next month) it will no longer work. If you use the correct format(s), it will work correctly now and in the future.

What you need to use is what anhn posted near the start of this thread, which is the same as what is shown in the first FAQ article that I linked to.

OK OK. You are right. And anhn is right too. I was cofused when It worked for the both date formats. And the reason was, as anhn said, it correctly converted the date where day is > 12. When I tested it for day < 12, it failed. Sorry for the messing up.
Ok sajankk hope you didnt get cofused of what I said. you have to use either mm/dd/yyyy or YYYY-mm-dd for your querry.