M writing a program to display the date ie. 15 days later after a given (present/todays)date.
Wel its actually like this. As soon as i write todays date, in the next text box, the date shd be automatically displayed adding 15 days to the present date which is already displayed.
Eg. supose i enter 01/06/2008 (dd/mm/yyyy), it shud automatically display 15/06/2008.
M trying to use
Datediff() function, but i dont know how to go about.

can anyone plz help me with the code..?

In C#:

string strDate = "20/10/1983";
DateTime date = DateTime.Parse(strDate);
string newDate = date.AddDays(15).ToShortDateString();

Hi,

Use DateAdd function

Dim TDate As Date
TDate = CDate("01-06-2008")
MsgBox DateAdd("d", 15, TDate)

Regards
Veena

Similar to Veena, I give another way

Dim TDate As Date
   TDate = Date
   MsgBox TDate + 15

Still same result

Note:
Date object plus number will work only for days addition, but DateAdd() function will work for any interval

Thanks lots to all of u for help. M on it right away. Actually i'll be taking the date from the user tru da text box (n tn accept it in a string i suppose..)and try to add using the DateAdd function. The new date will be displayed in the next textbox. So after say 15 days it shud display a msg or change the background color i gs. M using Grid Control layout to display the Datas. MS Access is my database.

Have a Wonderful day ahead!!!!

made it this way.

Private Sub Text5_Lostfocus()
    Dim PDate, RDate As Date
    PDate = CDate(Text5.Text)
    RDate = DateAdd("d", 15, PDate)
    Text6.Text = RDate
End Sub
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.