I have a textbox
and i would love it to be formatted. fortunately for me, i can get this done by changing the textmode = DateTimeLocal
. Exactly what I want. Additionally, I would like to load this textbox with default values rather than leaving it with dd/mm/yy __:__:__
. I can change the text if it is a regular textbox (single mode
) or even a datetime textbox. but i cannot change it with DateTimeLocal
mode. some help please. thank you.
You will have to format the DateTime to a valid Date and Time string that can be parsed, here is one that works:
txtDateTimeLocal.Text = DateTime.Now.ToLocalTime().ToString("yyyy-MM-ddTHH:mm");
For more details on what other attributes you can set, see: http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#local-date-and-time-state-(type=datetime-local)