I am developing a small Intranet application where all date displays are being handled by the DatePicker control. In many cases, the server is sending a date value to the browser where a Javascript function is getting the date and setting the datepicker to the received date.

For example, if the Server sends a date as '6/20/2006', the Javascript sets the date into the Datepicker as
document.Form1.DtPicker1.Value = <%=mDate%> ;

The problem is different users have set different date formats in the PCs from the Regional Settings options. So a date like '5/9/2006' is being interpreted as '9th May, 2006' in some machines and '5th September, 2006' in some machines. :-/

How can this problem be solved ? Can the browser be forced to interpret such dates in a fixed way, irrespective of the regional settings ?

Send your dates in ISO format yyyymmdd I think javascript can handle that format.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.