I'm doing a Web .Net application, on MVC. I create a controller:
[HttpPost]
public JsonResult Fechas() {
DateTime fecha = DateTime.Now;
List<listas.Ffechas> actualFecha = new List<listas.Ffechas>();
actualFecha.Add(new listas.Ffechas( fecha.Year.ToString(),
fecha.Month.ToString(),
fecha.Hour.ToString(),
fecha.Minute.ToString(),
fecha.Second.ToString(),
fecha.Millisecond.ToString()
));
return Json(new { actualFecha, JsonRequestBehavior.DenyGet });
}
This controller its based on a List Model:
public class Ffechas {
public string FYear { get; set; }
public string FMonth { get; set; }
public string FHour { get; set; }
public string FMinute { get; set; }
public string FSecond {get;set;}
public string FMiliseconds {get;set;}
public Ffechas(string CYear,string CMonth, string CHour, string CMinute, string CSecond, string CMiliseconds) {
FYear = CYear;
FMonth = CMonth;
FHour = CHour;
FMinute = CMinute;
FSecond = CSecond;
FMiliseconds = CMiliseconds;
}
}
And send the information in Json format. The point here is, How I can detect the actual culture or region language of the system and apply to my fecha Datetime, example:
if the actual system culture is ("en-us") the date is sended on that format or if the actual system culture is ("es-mx") the date is sended on that form.
I dont have problems with list or something like that, my issue is detect the culture system status and with this I can send through json the correct format. thanks for your help.