Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 date format issue

Author  Topic 

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-11-13 : 04:32:23

hi everyone,


In a storeprocedure.

i want to use date format

like this(dd.mm.yy)('28/12/2012') when i use this format the result is getting '0', only this date format(mm.dd.yy) is woriking .


select isdate('28/12/2012') result '0'

select isdate('12/28/2012') reult '1'

my query is i want to use (dd.mm.yy)('28/12/2012') result would be '1'

it is possible pls help.

Thanks

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-13 : 04:45:48
Check this
SET DATEFORMAT DMY
select isdate('28/12/2012' ) --result '1'

--
Chandu
Go to Top of Page

rajnidas
Yak Posting Veteran

97 Posts

Posted - 2013-11-13 : 04:54:27
thanks chandu sir.

Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-11-13 : 04:55:13
Welcome

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-13 : 07:43:49
quote:
Originally posted by rajnidas

thanks chandu sir.




make sure you read this
Always pass date values in unambiguos formats to avoid relying upon server settings to interpret the date

see

http://visakhm.blogspot.com/2011/12/why-iso-format-is-recommended-while.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -