Trimming field according to our convenience

jakie_ezu

New member
Joined
Apr 25, 2007
Messages
4
Programming Experience
3-5
hai ,
in one form i am retriving value from ms access and showing in text box, but it is showing with time also, i want to trim that time part from the date, we have stored the date as datatype data only... so we cant trim that field, because its not string, can u plz suggest one remady for this issue...
jakie...:rolleyes:
 
retrieve it into a date and format it, for example:

SELECT MAX(myDate) FROM myXXXTable

Dim dt as DateTime
dt = DirectCast(MyMaxDateOleDbCommand.ExecuteScalar(), DateTime)

myTextBox.Text = dt.ToString("dd MM yyyy")
 
try
textbox.text = dtval.date

You will then be relying on ToString()'s logic of not including the time portion if the time is midnight.. Which I'm not sure it does..

Public ReadOnly Property [Date]() As Date
Member of System.DateTime

Summary:
Gets the date component of this instance.

Return Values:
A new System.DateTime with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).

By being specific as to what format you want the time to appear in, you remove this ambiguity and potential bug..
 
I answered this to you on codeguru, i've also answered this here already, saying that I answered you on codeguru, and now youre posting AGAIN?!
 
You say you didnt find it there.. hmm.. did you search for all posts started by yourself? I'll replicate the advice here. Post the code you use to fill the combobox
 
threads merged. jakie_ezu, you don't need to start a new thread for this yet again.
 
Back
Top