Solved

Date to String

Posted on 2011-09-14
3
286 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 500 total points
ID: 36537376
dim x as datetime
datetime.tryparse(yourtextbox.text, x)
dim y as string
y = x.tostring("yyyyMMdd")
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 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