Keroleen Posted January 8, 2004 Posted January 8, 2004 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: Quote
Leaders Iceplug Posted January 9, 2004 Leaders Posted January 9, 2004 How did you use the DatePart function and why aren't you using the .NET System.DateTimes? Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
samsmithnz Posted January 9, 2004 Posted January 9, 2004 Yeh, I'd do something like: txt_sat.text = ctype(txt_beginning,datetime).addday(1).tostring But it would definetly help if you were using the datetime type. Quote Thanks Sam http://www.samsmith.co.nz
Keroleen Posted January 12, 2004 Author Posted January 12, 2004 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: txt_sat.Text = (DatePart("d", txt_beginning)) Quote
Leaders Iceplug Posted January 13, 2004 Leaders Posted January 13, 2004 What's the difference between an actual date and a full date? :confused: You can always provide a format string for .ToString() :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
Keroleen Posted January 22, 2004 Author Posted January 22, 2004 Thanks for your suggestions guys... Just for anyone who may need this: I solved this using this 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..:) Quote
splice Posted January 22, 2004 Posted January 22, 2004 ?! does this not do the same thing? txt_sun.Text() = adate.Day().ToString() Quote -=splice=- It's not my fault I'm a Genius!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.