Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Date to String

Posted on 2011-09-14
3
Medium Priority
?
290 Views
Last Modified: 2012-05-12
Hi There,

I am new to .net world.

 How to convert a date format to string. i.e I have date = 09/14/2011, I want that date to be converted to a specific format. i.e 20110914

Please advice.

Thanks.
0
Comment
Question by:theartha
[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
3 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 36537175
yourdatevariable.tostring("yyyyMMdd")
0
 

Author Comment

by:theartha
ID: 36537275
@emoreau:

I am capturing the date as String from the text box and its value is 09/14/2011. Before passing the value to store procedure, I have convert the above value into 20110914 format.

Thanks.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 36537376
dim x as datetime
datetime.tryparse(yourtextbox.text, x)
dim y as string
y = x.tostring("yyyyMMdd")
0

Featured Post

Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 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