Solved

Date to String

Posted on 2011-09-14
3
282 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
  • 2
3 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
yourdatevariable.tostring("yyyyMMdd")
0
 

Author Comment

by:theartha
Comment Utility
@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 69

Accepted Solution

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now