How to set datetime on datetime-local via jQuery

前端 未结 7 2027
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-18 15:43

I have datetime-local html control on my form and I need to set date and time on it dynamically via JS or jQuery. How can I do it?



        
7条回答
  •  甜味超标
    2021-02-18 16:17

    Here's a solution in formatting the date using momentjs.
    This will get the current date and time

    moment().format('YYYY-MM-DDThh:mm:ss.SSS')
    

提交回复
热议问题