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

前端 未结 6 1807
梦如初夏
梦如初夏 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 03:13

    'Is there any other way to get the current date time in any of my page. I don't want to use Session and cookies.' In that case you can use JavaScript

    Also, you don't need to use RegisterStartupScript. You can just call the GetDate() function in the onLoad event.

    
    

    However, you might want to read this SO thread for best practice in using window.onload, or consider using a framework such as jQuery and its document.ready

提交回复
热议问题