Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add text inside DateTime.ToString with C#?

Tags:

c#

.net

I want to add a 'at' inside my DateTime format string but every time I try it messes it up?

origin.ToString("dd/MM/yyyy at HH:mm:ss");

When its this it works fine... but looks a bit ugly.

origin.ToString("dd/MM/yyyy HH:mm:ss");

1 Answers

add escape sequence:

origin.ToString("dd/MM/yyyy 'at' HH:mm:ss")
like image 74
Jonathan Applebaum Avatar answered Oct 30 '25 02:10

Jonathan Applebaum