How to get client current date and time in asp.net?

前端 未结 6 1808
梦如初夏
梦如初夏 2021-01-07 02:52

I have a hidden field in my master page. And I set the current date and time as a value in that \"hiddenfield\" using Javascript. I am unable to get this hidden field value

6条回答
  •  一整个雨季
    2021-01-07 02:55

    How about use CulturalInfo From C# to get it?

    string currentFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

    this will return "dd/MM/yy" or "dd/M/YYY" any format in client

提交回复
热议问题