|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get yesterday dateHi,
In VB6 I used Now() -1 to get yesterday, but it's not allowed in vb.NET. Is there a similar way to do it in vb.Net? Thanks in advance May be work with
Now().AddDays(-1) Show quoteHide quote "Li Pang" wrote: > Hi, > > In VB6 I used Now() -1 to get yesterday, but it's not allowed in vb.NET. Is > there a similar way to do it in vb.Net? > > Thanks in advance Li Pang,
You mean this? Dim yesterday As DateTime = Now.AddDays(-1) I hope this helps, Cor Hi Li Pang,
You can use the following code: Dim oTimeSpan As New System.TimeSpan(1,0,0,0) Dim oDate As System.DateTime = System.DateTime.Now.Substract(oTimeSpan) and oDate should contain yesterdays date... Greetings, Juan Pedro Gonzalez Show quoteHide quote "Li Pang" <LiP***@discussions.microsoft.com> escribió en el mensaje news:96CB3185-0C56-47C6-8C95-0B1A3038E6B7@microsoft.com... > Hi, > > In VB6 I used Now() -1 to get yesterday, but it's not allowed in vb.NET. Is > there a similar way to do it in vb.Net? > > Thanks in advance Li Pang wrote:
> Hi, As others have posted, Now.AddDays(-1) is the literal translation of> > In VB6 I used Now() -1 to get yesterday, but it's not allowed in vb.NET. Is > there a similar way to do it in vb.Net? > > Thanks in advance the VB6 expression Now() - 1. But if you want *yesterday*, rather than *this time yesterday*, you should be using Today, not Now. -- Larry Lard Replies to group please
Need to sort ListView columns that contain dates
Need Help with Shell Accessing dlls at runtime C# to VB crossover questions hide control based on SQLS2K column level permission GetType and ApplicationClass About MessageQueue Problem Copy protection System Font Calling UserControl from within a form in the control... |
|||||||||||||||||||||||