HOW TO CONVERT DATETIME FORMAT C#?

marcel ethan

Total Post:105

Points:735
Posted by  marcel ethan
C#  DateTime 
 1184  View(s)
Ratings:
Rate this:

Here is my date time format displayed

Dr["DATE"] =========> Jun 27 2014 9:06PM

I want it to display like this one =========> 27.06.2014

Here is my code:

ltrlNotlar.Text = Dr["DATE"].ToString()

How to change first format to the second one?

  1. Takeshi Okada

    Post:89

    Points:629
    Re: How to convert Datetime Format C#?

    use DateTime to do the conversion for you

    var dt = DateTime.Parse(Dr["DATE"].ToString());

    ltrlNotlar.Text = dt.ToString("dd.MM.yyyy");

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!