Photo by Panos Sakalakis on Unsplash

Change DateTime Format in ASP.NET Core Web API for JSON

How .NET Core formats the date time? Declare a variable of type DateTime in ASP.NET Core and print its value. What will you get? DateTime dt = DateTime.Now; Console.WriteLine(dt); I got the following output in my local system. The format is dd/MM/yyyy hh:mm:ss tt 23/02/2023 10:50:03 am If you run the same program in your system, you might get a different output. Since we used DateTime.Now, we did not specify any locale or format, so it picks the default System locale and date time format....

5 min · 905 words · Saqib Razzaq