Get the client's date with a server language? Impossible. You will have to generate it with javascript in the client and send it to the server.
You can use a input[hidden
] to save the client's date and send it:
var input = document.querySelector("#fecha_cliente");
var fechaCliente = new Date();
input.value = fechaCliente.getDay() + "/" + fechaCliente.getMonth() + 1 + "/" + fechaCliente.getFullYear();
<input type="text" name="fecha_cliente" id="fecha_cliente"/>
You just have to change the type text
to hidden and ready.
Update:
Here is how to convert the date to System.DateTime
when you receive it on the server:
var dateParts = fecha_cliente.Split('/').Select(Int.Parse).ToArray();
var fechaCliente = new DateTime(day: dateParts[0], month: dateParts[1], year:dateParts[2]);