How to perform date formatting in the listview item text property? It is currently displaying #2011/08/08# and I want to convert it to "mm-dd-yyyy".
Please help!
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Sep 14, 2011, 2:58 AM EDT
However, if you're using databinding, it might be easier to format the date before binding takes place.
latika singh28 reputationPosted Sep 14, 2011, 4:28 AM EDT
But now i need to use these variables stDate and eDate into another sub to print Cycle Time. Check the line below:
TempArray() = translate ("Cycle Time") & stDate.ToshortDateString & eDate.ToShortDateString.
This line is in another sub. I need to pass the above two variables in this line.
VulpesRank #55 · 29.2K reputationPosted Sep 14, 2011, 5:06 AM EDT
You can then print the array with code such as this:
latika singh28 reputationPosted Sep 14, 2011, 5:30 AM EDT
stDate = CDate(ListView1.Items(0).Text).ToShortDateString
eDate = CDate(ListView1.Items(ListView1.Items.Count - 1).Text).ToShortDateString
End Sub
The two variables above, I want to pass them to another sub inside line:
strTempArray(7) = translate("CYCLE TIME: ") & stDate.ToShortDateString & " -- " & eDate.ToShortDateString
Currently I am ignoring the ConvertDateTime() and declaring the above variables locally in another sub to store in the strTempArray(7) variable.
Is it possible to do it by creating a subroutine that separately stores Listview item string and then pass these variables the way it is now in the temp array variable?
VulpesRank #55 · 29.2K reputationPosted Sep 14, 2011, 6:13 AM EDT
latika singh28 reputationPosted Sep 14, 2011, 6:51 AM EDT
to strTempArray(7) = translate("CYCLE TIME: ") & Me.ConvertDateTime(stDate, eDate)
Says, expression does not produce a value.
VulpesRank #55 · 29.2K reputationPosted Sep 14, 2011, 7:02 AM EDT