简体   繁体   中英

how do set input type date default value today in .net

How can i set default value today

<div class="col-md-12 col-sm-12 text-center">
    <label for="start">Günün Menüsü için Tarih Seçiniz:</label>

    <input type="date" runat="server" id="datee" name="trip-start"
           value=""
           min="2021-01-01" max="2022-12-31">

</div>

and i dont wanna like this在此处输入图像描述

i wanna like this example today = 29.03.2021

for .net you can add @DateTime.Today.ToString("yyyy-MM-dd") in value, Please replace below code and check.

<input type="date" runat="server" id="datee" name="trip-start"
       value='@DateTime.Today.ToString("yyyy-MM-dd")'
       min="2021-01-01" max="2022-12-31">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM