Hi AliYilmaz,
You can't get the DateTime form the client PC using code behind because the code behind is executed on the SERVER.
You can use JavaScript to get the current DateTime from the browser.
Controller
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
View
<span id="lblClientDateTime" style="font-weight:bold"></span>
<script type="text/javascript">
window.onload = function () {
var dt = new Date().toLocaleDateString() + " " + new Date().toLocaleTimeString();
document.getElementById('lblClientDateTime').innerHTML = dt;
}
</script>
Output
11/15/2023 3:42:50 PM