dbTalk Databases Forums  

Dates and Regional Settings

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss Dates and Regional Settings in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter
 
Posts: n/a

Default Dates and Regional Settings - 07-03-2005 , 02:17 AM






Hi,
I know this is an old chestnut, but I just can't understand why this
function returns "0" -

iif(cdate("08/03/2005")>cdate(date()), 0, 1)

Todays date is "03 July 2005". My regional settings are set to
"DD/MM/YYYY". If I change the first argument to "08 March 2005" I get
the same result.

Any Ideas - this is driving me screwy...

Thanks,
Peter


Reply With Quote
  #2  
Old   
GunnarKarlsson
 
Posts: n/a

Default RE: Dates and Regional Settings - 07-03-2005 , 06:05 AM






Try iif(cdate("08/03/2005")>cdate(Now()), 0, 1)


Gunnar
--
Not a Guru


"Peter" wrote:

Quote:
Hi,
I know this is an old chestnut, but I just can't understand why this
function returns "0" -

iif(cdate("08/03/2005")>cdate(date()), 0, 1)

Todays date is "03 July 2005". My regional settings are set to
"DD/MM/YYYY". If I change the first argument to "08 March 2005" I get
the same result.

Any Ideas - this is driving me screwy...

Thanks,
Peter



Reply With Quote
  #3  
Old   
Jéjé
 
Posts: n/a

Default Re: Dates and Regional Settings - 07-03-2005 , 07:19 AM



try the format : YYYYMMDD (20050308)

"Peter" <peterr (AT) intellimaxsolutions (DOT) com> wrote

Quote:
Hi,
I know this is an old chestnut, but I just can't understand why this
function returns "0" -

iif(cdate("08/03/2005")>cdate(date()), 0, 1)

Todays date is "03 July 2005". My regional settings are set to
"DD/MM/YYYY". If I change the first argument to "08 March 2005" I get
the same result.

Any Ideas - this is driving me screwy...

Thanks,
Peter




Reply With Quote
  #4  
Old   
Peter
 
Posts: n/a

Default Re: Dates and Regional Settings - 07-03-2005 , 04:27 PM



wow - it actually worked, I have no idea why though.

It looks like the 'Date()" function always returns a date ini US format
ie. MMDDYYYY, whereas the "Now()" function is sensitve to regional
settings.

Thanks for the tip anyway.

Cheers,
Peter.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.