c# how to convert yyyy-MM-ddT18:30:00.000Z to a string value of MM/dd/yyyy hh:mm:ss PM

Viewed 42

My API request has this value assigned to a datetime object yyyy-MM-ddT18:30:00.000Z . Now while saving it in SQL I need to save it as a string value of MM/dd/yyyy hh:mm:ss PM.

In c# how to do this conversation before sending the string to sql ? I tried the below, but it is showing result as "2022-11-03T00:00:00.0000000Z" where the timestamp is incorrect. Please guide.

ackdate.Value.ToString("yyyy-MM-dd'T'HH:mm:ss.fffffff'Z'");
0 Answers
Related