Solved

DateDiff Function - European Dates

Posted on 2004-09-07
7
269 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

747 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

13 Experts available now in Live!

Get 1:1 Help Now