Avatar of SasfinSD
SasfinSD

asked on 

The curious case of the Missing 0

Hi everyone.

Just need quick help with a DateTime convert.

The code below outputs the time in the correct Long format but throws away the Zero (as the system does).

I need the zero back, but don't really want to do a substring.

My output is this : 5:58:50 PM , but unfortunately my database field wants this : 05:58:00pm

Does anyone have a better solution to convert to this Time format : hh:mm:ss(AM/PM) ?

Tx
DateTime theTime = DateTime.Now;
            lblDate0.Text = theTime.ToLongTimeString();

Open in new window

C#ASP.NET

Avatar of undefined
Last Comment
SasfinSD

8/22/2022 - Mon