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

x
?
Solved

How to convert a DateTime value to a formatted string

Posted on 2009-05-06
4
Medium Priority
?
673 Views
Last Modified: 2012-05-06
I have a DateTime value that needs to be converted to a formatted string.

DateTime dteChangeDate;

dteChangeDate = DateTime.Parse(calCalendar.SelectedDate.ToString());

Returns {5/4/2009 12:00:00 AM}

How do I convert this to the following string using C#:

string strChangeDate;

strChangeDate = a function or method of dteChangeDate that returns "20090504" ???

Thanks,
0
Comment
Question by:Dovberman
[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
4 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 24315490
0
 
LVL 9

Accepted Solution

by:
tetorvik earned 500 total points
ID: 24315524
dteChangeDate .ToString("yyyyMMdd");
0
 
LVL 60

Assisted Solution

by:Kevin Cross
Kevin Cross earned 500 total points
ID: 24315546
strChangeDate.ToString("yyyyMMdd")
0
 

Author Closing Comment

by:Dovberman
ID: 31578487
This works well. Thanks.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

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