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
 Development Tools
 ASP.NET
 Get the previous date

Author  Topic 

reflex2dotnet
Yak Posting Veteran

99 Posts

Posted - 2007-03-08 : 17:02:15
Hi all

I am calculating the date difference between 2 dates as
Dim t As DateTime
Dim span As TimeSpan
t = DateTime.Parse(Session("startDate"))
Dim t2 As DateTime
t2 = DateTime.Parse(Session("endDate"))
span = t2 - t

If the span is 0, ies the start and endDate are same, i want to get the preivous date.
Suppose both dates are today.. 3/8/2007
i want to get 3/7/2007

How can i do this?
Any ideas?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-03-08 : 17:12:00
You can use the .NET DateAdd function to do this. Just add -1 to the date.

Tara Kizer
Go to Top of Page

reflex2dotnet
Yak Posting Veteran

99 Posts

Posted - 2007-03-09 : 10:39:41
Thanks i got it worked
Go to Top of Page
   

- Advertisement -