Date and Time Format

  • Thread starter Thread starter haoli12345
  • Start date Start date
H

haoli12345

Guest
I want to format my date like 2002/06/13 I dont know how to do it in ASP but I know how to do it in Visual Basic Format(Date, "YYYY/MM/DD") is there a way to do this in ASP. I would also like to format my time in 24 hours mode like this 15:06:32 if you know please reply. Thank You.


-Hao Li-
 
formatdatetime("June 13, 2002",DateFormat.ShortDate)

returns 6/13/2002, don't know how to display
2002/06/13, maybe you can not
 
Idea

Here's what we have done at my work.....

If txtDate.Text <> "" Then
Dim dtdate As Date
Dim sDate As String

sDate = txtDate.Text
dtdate = CDate(stDate)
txtDate.Text = CStr(Format(dtdate, "MM/dd/yyyy"))
End If

Basically, if you're obtaining the date as a text field, you should then convert it into date, then back into text field with the format. We don't convert it back to Date field after that, we just stick it into a text box for display to the user.
 
Thinker,

I don't know as to whom that question was anchored toward, but at my work, it's all .Net (ASP.Net, VB.Net, C#.Net, etc.) and it's all Web App Development, if that answers your question. My apologies if it doesn't.
 
Back
Top