0

Here is a example for my work.
if a date ---> 20/03/2012 should be shown as 01/04/2012
16/12/2011 Should be shown as 01/01/2012
02/05/2008 Should be shown as 01/06/2012

My requirement is to get a given date as 1st of next month.

I know to do this with IF conditions. But I want to know, is there any already define function for doing my work like DATEDIFF. (DATEDIFF can get date difference)

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by poojavb
1

Use DateTime.AddMonths, AddDays methods.

    Dim dt = #12/20/2010#
    dt = dt.AddMonths(1)
    dt = dt.AddDays(-(dt.Day - 1))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.