Solved

DateDiff Function - European Dates

Posted on 2004-09-07
7
271 Views
Last Modified: 2006-11-17
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'

Thanks,
Aviva
0
Comment
Question by:avivak1
  • 4
  • 3
7 Comments
 
LVL 7

Expert Comment

by:bluV11t
ID: 11996504
Try adding "Set dateformat dmy;" at the start of your sql-statement.
0
 

Author Comment

by:avivak1
ID: 11996517
let me rephrase..I'm using the DateDiff function
0
 

Author Comment

by:avivak1
ID: 11996522
and if i do change the regional settings would that change the Now() function to european date format?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:bluV11t
ID: 11996564
My mistake... I assumed you were using datediff in a database query.
0
 
LVL 7

Expert Comment

by:bluV11t
ID: 11996623
I'm quite sure changing regional settings would change Now() functions return to the format you specify.
0
 
LVL 7

Accepted Solution

by:
bluV11t earned 40 total points
ID: 11996732
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)
0
 

Author Comment

by:avivak1
ID: 11996744
blah ok :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now