Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET - VB.NET - How to format date string?

Posted on 2006-11-21
4
Medium Priority
?
701 Views
Last Modified: 2010-05-18
I am pulling a datetime field from a sql server db and am writing it to an html page as follows:

Response.Write("On " & odr("sampledate") & ", blah blah blah!")

It shows up like this:  5/16/2006.

How can I format the date as follows:

1.  May 16, 2006
2.  5/16/06
3.  May 16th

thank you!
0
Comment
Question by:sah18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
kraffay earned 1000 total points
ID: 17989304
1.  Response.Write("On " & String.Format("{0:MMM dd, yyyy}", odr("sampledate"))   & ", blah blah blah!")
2.  Response.Write("On " & String.Format("{0:MM/dd/yy}", odr("sampledate"))   & ", blah blah blah!")
3.  Don't think that's possible?

 
0
 
LVL 9

Author Comment

by:sah18
ID: 17990058
thank you very much!
0
 
LVL 9

Author Comment

by:sah18
ID: 17997606
I know I already awarded points on this, but one clarification:

for format option 1, the month is being truncated to 3 characters only (ex: Apr)... is there a way to get the full month showing up?
thank you again!
0
 
LVL 9

Expert Comment

by:kraffay
ID: 17997857
Here it is:

Response.Write("On " & String.Format("{0:MMMM dd, yyyy}", odr("sampledate"))   & ", blah blah blah!")


ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbalr/html/e51b77e6-9c84-48d6-83d8-08aef8cacab1.htm
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question