---
title: "Convert date in string to DateTime with same format"  
description: "Convert date in string to DateTime with same format"  
author: "Anonymous User"  
published: 2013-05-10  
updated: 2013-05-10  
canonical: https://www.mindstick.com/forum/853/convert-date-in-string-to-datetime-with-same-format  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Convert date in string to DateTime with same format

Hi Guys!\
I have a [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) that has a [date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner) [stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) in it.\
String date = "03-05-2013 00:00:00";I parsed it to [Datetime](https://www.mindstick.com/forum/12949/how-to-validate-if-a-datetime-field-is-not-null-empty) as follows:\
DateTime Start = DateTime.Parse(date);Start.ToString() gave me "3/5/2013 12:0:00 AM"\
I also used:\
DateTime Start = DateTime.ParseExact(date,"dd-MM-yyyy HH:mm:ss",CultureInfo.InvariantCulture);Then, Start.ToString() gave me "3/5/2013 12:0:00 AM", which is the exact same [result](https://www.mindstick.com/blog/12011/advantages-of-getting-result-oriented-seo-from-an-agency) as the [previous](https://yourviews.mindstick.com/view/81421/unlock-2-0-is-just-like-previous-corona-lockdowns) one. I need to keep the original formatting. How may I do it? \
Thanks in in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!.

## Replies

### Reply by AVADHESH PATEL

Hi Goti!\
\
The format you parse with does not dictate how the DateTime is formatted when you convert the date back to a string. You need to pass the format into ToString() \
i.e.\
Start.ToString("dd-MM-yyyy HH:mm:ss");


---

Original Source: https://www.mindstick.com/forum/853/convert-date-in-string-to-datetime-with-same-format

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
