I am quite new to ASP.Net Core MVC. I am trying to display the current time in input type time. But I am not able to do so. Below is the code I am trying.
<input type="time" id="starttime" value="@DateTime.Now.ToString("hh::mm::ss tt")" />
The time picker shows blank. I also tried by setting time by script but no luck.
Could someone please help? Isnt it possible to display current time in this manner?
Per the documentation: "The control's user interface varies from browser to browser".
SUGGESTIONS:
FYI, I don't think the format "hh::mm::ss tt" is valid for any browser.
I tried these different format strings on Chrome:
Format Status Display:
------ ---- -------
hh::mm::ss tt FAILS --:-- --
hh:mm OK 12:33 PM
hh:mm:ss OK 12:33:38 PM
hh:mm:ss tt FAILS --:-- --
hh::mm FAILS --:-- --