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)

Use DateTime.AddMonths, AddDays methods.

    Dim dt = #12/20/2010#
    dt = dt.AddMonths(1)
    dt = dt.AddDays(-(dt.Day - 1))

Thanks. I'l Try this

Hey thanks...it worked perfectly fine...even I needed the same....Thanks _avd

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.