| | |
code to add 15 days to a given date.
Thread Solved |
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..?
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..?
Hi,
Use DateAdd function
Regards
Veena
Use DateAdd function
vb Syntax (Toggle Plain Text)
Dim TDate As Date TDate = CDate("01-06-2008") MsgBox DateAdd("d", 15, TDate)
Regards
Veena
Similar to Veena, I give another way
Still same result
Note:
Date object plus number will work only for days addition, but DateAdd() function will work for any interval
VB Syntax (Toggle Plain Text)
Dim TDate As Date TDate = Date MsgBox TDate + 15
Note:
Date object plus number will work only for days addition, but DateAdd() function will work for any interval
Last edited by selvaganapathy; Jun 24th, 2008 at 12:27 pm.
KSG
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!!!!
Have a Wonderful day ahead!!!!
made it this way.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Text5_Lostfocus() Dim PDate, RDate As Date PDate = CDate(Text5.Text) RDate = DateAdd("d", 15, PDate) Text6.Text = RDate End Sub
![]() |
Similar Threads
- Starting Python (Python)
- calculate the date difference between two dates exclude the saturday and sunday (Java)
- Adding x amount of days to a specific date? (PHP)
- array structs, size swap functions, the amount of days between to dates (C++)
- C++ Date Class (C++)
- Program- calculate # of days between two days (C++)
- please help! (C++)
- Calendar Creator (C)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: sound recording through vb program?
- Next Thread: How to get "user account"
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





