Help: "adding" days to a date

Keroleen

Active member
Joined
Sep 15, 2003
Messages
36
I have an application where I need to output the actual DATE of the month into a textbox.

so I have txt_sat.text = (DatePart("d", "txt_beginning))

where txt_sat is the text box
and txt_beginning stores the actually date (ie. 1/1/2003)

This gives me what I want. The date of the month..(ie. 27, 2, etc)

However I want to date of each day of the week in the same format. I can only get the first day and last day working.

for the dates in between I tried

txt_wed.text= DateAdd("d", 4, txt_beginning))

this does give the correct date but in the format of 12/1/2002
HOw do I make it so that it extracts only the date (in this case the 1???

I think it should be the datepart function but if i use that i get this following error

Additional Information: Argument datevalue cannot be converted to type date


Thanks in Advance :confused:
 
Yeh, Id do something like:
Code:
txt_sat.text = ctype(txt_beginning,datetime).addday(1).tostring


But it would definetly help if you were using the datetime type.
 
Hey guys: Thanks for your suggestions

i think that its not using datetime, but rather date
I thought of using a Ctype convert b4 but it seems what i need is the actual date and not full date(at full date its working the way i want it to ;) ]


IcePlug: DatePart function was as follows:

Code:
  txt_sat.Text = (DatePart("d", txt_beginning))
 
Thanks for your suggestions guys...

Just for anyone who may need this: I solved this using this

Code:
Dim adate As Date
        adate = strTemp
        adate = adate.AddDays(1)
        txt_sun.Text = (DatePart("d", adate))
        adate = strTemp
        adate = adate.AddDays(2)
        txt_mon.Text = (DatePart("d", adate))


Its probably not the BEST way but it works for me..:)
 
Back
Top