I want to convert and restrict the DateTime to 12 hours format.
Right now the output is: 02-01-2022 18:30 PM
But I want to convert into: 02/01/2022 06:30 PM +00:00.
I want to convert and restrict the DateTime to 12 hours format.
Right now the output is: 02-01-2022 18:30 PM
But I want to convert into: 02/01/2022 06:30 PM +00:00.
2
Answers
DateTime.Now.ToString("MM/dd/yyyy hh:mm tt")
Add tt at last for AM/PM
or
where hh is for 12 hours format and tt for AM/PM as in this documentation.