.Net format datetime string

How do I format Now() to reflect this exact formatting?

12-12-2017:09:40:00:0000
Larry Bristersr. DeveloperAsked:
Who is Participating?
 
Rgonzo1971Commented:
Hi,

pls try
string timestamp = DateTime.UtcNow.ToString("dd-MM-yyyy-HH:mm:ss.fff",
                                            CultureInfo.InvariantCulture);

Open in new window

Regards
0
 
Pawan KumarDatabase ExpertCommented:
Pls use

DateTime.Now.ToString("dd-MM-yyyy-HH:mm:ss.fff");

OUTPUT

13-12-2017-22:16:49.785
0
 
Larry Bristersr. DeveloperAuthor Commented:
Put me on the right track...
But this gets me the EXACT output I requested...

 Dim timestamp As String = System.DateTime.UtcNow.ToString("MM:dd:yyyy:HH:mm:ss.fff", CultureInfo.InvariantCulture)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.