I wonder if someone has stumbled upon this type of scenario before. Please tell me how you fixed it.
So, on my development PC, my date format is DD/MM/YYYY. It shows the same format when I "Run"(F5) the project and test stuff. However, when publishing to the web server and a user goes to the date, the format is in MM/DD/YYYY.
For your information: The settings on the Web Server are exactly the same as on the development PC. Both have the same region, the same dateTime format in Control Panel -> Region.
I do not code any funny regional settings in my code because it is just a dateTimePicker displaying a javascript calender from which the user chooses.
Code for reference: The datetimepicker:
<script type="text/javascript">
$(document).ready(function() {
// Datepicker Popups calender to Choose date.
$(function() {
$("#datepicker_end").datepicker();
// Pass the user selected date format.
$("#format").change(function() {
$("#datepicker_end").datepicker("option", "dateFormat", "dd-mm-yy");
});
});
});
</script>
<script type="text/javascript">
$(".date-pick").datepicker();
$(".date-pick").datepicker('setDate', new Date());
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('#datepicker_start').datepicker({ dateFormat: 'dd-mm-yyyy' }).val(today);
$('#datepicker_start').show();
</script>
That's everything I can give you. Tried googling multiple things but can't find a solution. Thanks.
EDIT Okay, I did the formatting piece as Frederico suggested. No luck. Anyone else have some other ideas/suggestions??