' How to get the Last day of month
Dim currentDate As DateTime = DateTime.Now.Date Dim sDate As DateTime = currentDate.Subtract(New TimeSpan(currentDate.Day - 1, 0, 0, 0, 0)).ToShortDateString() Dim EndDate As String=sDate.Add(New TimeSpan(DateTime.Now.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month)-1, 0, 0, 0, 0)).ToShortDateString()
Public Function ComputeLastDayOfMonth(ByVal TheDate As Variant) As Integer LastDayOfMonth = DatePart("d", DateAdd("d", -1, DateAdd("m", 1, DateAdd("d", - DatePart("d", TheDate) + 1, TheDate)))) End Function
intX = ComputeLastDayOfMonth("2/2000")
|
| Author: Deepa 14 Jun 2008 | Member Level: Diamond Points : 0 |
Thanks m looking for this code
|
| Author: Kapil Dhawan 16 Jun 2008 | Member Level: Gold Points : 1 |
Hello, Nice piece of Code. Thanks for sharing your knowledge with us.
Regards, Kapil
|
| Author: Shivshanker Cheral 17 Jun 2008 | Member Level: Diamond Points : 0 |
Thanks to all
|
| Author: Sarfraz Ahmad 17 Jun 2008 | Member Level: Silver Points : 0 |
Thanks
|
| Author: Bunty 27 Jun 2008 | Member Level: Diamond Points : 2 |
Hi, Nice piece of code to calculate last day of the month.
If possible give me some theoritical description to do this.
Keep Posting.
Thanks for sharing your knowledge.
Thanks and Regards S.S.Bajoria
|