hello,
i want to get thedata from database yestday 6pm to today 6pm.
how can i write code using c#.net and sql 2005 plz helpme...
hello,
i want to get thedata from database yestday 6pm to today 6pm.
how can i write code using c#.net and sql 2005 plz helpme...
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Johnny GC44 reputationPosted May 18, 2008, 10:11 PM EDT
DateTime minus1day = DateTime.Now().AddDays(-1);
minus1day = new DateTime(minus1day.Year, minus1day.Month, minus1day.Day, 18, 0, 0);
Johnny.
Blocked AccountRank #403 · 6.2K reputationPosted May 18, 2008, 10:31 PM EDT
U can do this by writing the stored procedure like that.
declare @PreviousDate varchar(30)
declare @CurrentDate varchar(30)
set @PreviousDate = (select convert (varchar(30),getdate()-1,101)+' 18:00:00.000' )
set @CurrentDate = (select convert (varchar(30),getdate(),101)+' 18:00:00.000' )
select * from TableName where CreatedDate between @PreviousDate and @CurrentDate
Dipal ChoksiRank #199 · 12K reputationPosted May 18, 2008, 10:43 PM EDT