DateDiff Function - European Dates

Without changing the regional settings of a machine......

How can I compare 2 european dates without getting the number 31 by comparing '07/09/04' and  '08/09/04'

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try adding "Set dateformat dmy;" at the start of your sql-statement.
avivak1Author Commented:
let me rephrase..I'm using the DateDiff function
avivak1Author Commented:
and if i do change the regional settings would that change the Now() function to european date format?
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

My mistake... I assumed you were using datediff in a database query.
I'm quite sure changing regional settings would change Now() functions return to the format you specify.
You probably have to rearrange the dates yourself before comparing it, somthing like this...

day1 = datepart(d, '07/09/04')
month1= datepart(m, '07/09/04')
year1= datepart(y, '07/09/04')
date1=day1 & "/" & month1 & "/" & year1

day2 = datepart(d, '08/09/04')
month2= datepart(m, '08/09/04')
year2= datepart(y, '08/09/04')
date2=day2 & "/" & month2 & "/" & year2

difference = datediff(d, date1, date2)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
avivak1Author Commented:
blah ok :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.