Hi,
I am currently using this code
DateTime.Now.ToString(“hh:mm”)
To get the current time, however how do i change the format to 24 hours and have a am or pm after it.
any help is appreciated
Hi,
I am currently using this code
DateTime.Now.ToString(“hh:mm”)
To get the current time, however how do i change the format to 24 hours and have a am or pm after it.
any help is appreciated
If you also want AM or PM afte rit, you can use Datetime.Now.ToString("hh:mm tt")
.
Just for me to understand, so it is “HH:mm tt” gives in 24hrs format and “hh:mm tt” will give in 12hrs format?
That’s correct. HH gives the 24-hour format and hh gives the 12-hour format.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.