Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert date to string format yyyy-mm-dd HH:MM:SS - C# [duplicate]

Tags:

c#

datetime

Possible Duplicate:
format date in c#

How do I convert a date into the following string format?

2011-07-25 15:45:00

like image 908
Michael Kniskern Avatar asked Jan 24 '26 07:01

Michael Kniskern


1 Answers

here is a pretty good string formatting reference. for your question, you want something like this:

MyDateTime.ToString("yyyy-MM-dd hh:mm:ss");
like image 199
Muad'Dib Avatar answered Jan 26 '26 19:01

Muad'Dib



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!