Jump to content
Xtreme .Net Talk

Date and Time Format


Recommended Posts

Guest haoli12345
Posted

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-

Guest Tony555
Posted

formatdatetime("June 13, 2002",DateFormat.ShortDate)

 

returns 6/13/2002, don't know how to display

2002/06/13, maybe you can not

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...