Advertisement

06.18.2008 at 06:56AM PDT, ID: 23495199
[x]
Attachment Details

DateTime.ToString problem

Asked by zell71 in C# Programming Language, Microsoft Visual C#.Net

Tags: c#

i'm reading in a datetime from a database and then outputting to another text file.
However, the following code appears to display a date incorrect...such as: 18 00 2008
myCurrentLine.Append(((DateTime)this.m_Headers.Rows[this.m_HeadersProcessed + i]["Order Date"]).ToString("dd mm yyyy"));

If i leave it without formatting:
myCurrentLine.Append(((DateTime)this.m_Headers.Rows[this.m_HeadersProcessed + i]["Order Date"]).ToString());
i get the following result: 18/06/2008 00:00:000

What i need to display is just: 18 06 2008

any ideas why its setting the month incorrectly with this code:
myCurrentLine.Append(((DateTime)this.m_Headers.Rows[this.m_HeadersProcessed + i]["Order Date"]).ToString("dd mm yyyy"));Start Free Trial
[+][-]06.18.2008 at 06:58AM PDT, ID: 21812908

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C# Programming Language, Microsoft Visual C#.Net
Tags: c#
Sign Up Now!
Solution Provided By: Sh4d1
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.18.2008 at 07:01AM PDT, ID: 21812941

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628