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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 problem in date

Author  Topic 

abhit_kumar
Posting Yak Master

147 Posts

Posted - 2008-11-14 : 23:36:53
hello friends,
i was stuck in one logic of date in Storeprocedure.
I have two date type of field, suppose in first field 12/25/2008 is there,so i want a logic in which it will return minus one day in second field.

First field:- 12/25/2008
Output should be:- 12/24/2008

Please help me,
Thanks,
Abhi

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2008-11-14 : 23:49:31
Look at Datediff function in books online.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-14 : 23:50:18
just use
DATEADD(dd,DATEDIFF(dd,0,FirstField),-1) 

for second field
Go to Top of Page

karthickbabu
Posting Yak Master

151 Posts

Posted - 2008-11-14 : 23:51:59
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=114073

====================================================
you realize you've made a mistake, take immediate steps to correct it.
Go to Top of Page
   

- Advertisement -