harmmeijer
Programmer
Here is some code checking the Outlook date format:
Same script same user gives me dmy in outlook vb editor but
mdy in IE.
Regional settings are: Dutch, short date: d-M-yyyy long date: dddd d MMMM yyyy
More suprising the following gives me 1 in vbs but 2 in java:
The problem is that I need to insert a Calendar (Appointment) item in Outlook. Not sure what the user did with locale settings so I have to check the actual locale settings.
Looked on google for this phenomenom but could not find any bug in IE saying that javascript ignores locale settings when creating a date. Current sollution is:
Greetings, Harm Meijer
Code:
this.checkDateFormat = function(){
out = new ActiveXObject( "Outlook.Application" );
var aItem = out.CreateItem(this.ItemType);
aItem.Start = "5-31-2005 20:30";
if(aItem.Start.startsWith("31")) {
return "dmy";
}else{
return "mdy";
}
aItem.Close(1);
}
Same script same user gives me dmy in outlook vb editor but
mdy in IE.
Regional settings are: Dutch, short date: d-M-yyyy long date: dddd d MMMM yyyy
More suprising the following gives me 1 in vbs but 2 in java:
Code:
<script language="VBScript">
msgbox day(cdate("01/02/2000")) ' will be 1 is correct according to locale settings
</script>
<script language="JavaScript">
alert(new Date("01/02/2000").getDate()); // will be 2 is incorrect according to locale settings
// try it this way then:
alert(new Date(2000,0,2).toLocaleString().substring(0,2)); // is 01 which means that month comes before day
</script>
The problem is that I need to insert a Calendar (Appointment) item in Outlook. Not sure what the user did with locale settings so I have to check the actual locale settings.
Looked on google for this phenomenom but could not find any bug in IE saying that javascript ignores locale settings when creating a date. Current sollution is:
Code:
this.checkDateFormat = function(){
out = new ActiveXObject( "Outlook.Application" );
aItem = out.CreateItem(1);
aItem.Start="01-03-2005";
var d = new Date(aItem.Start);
aItem.Close(1);
if(d.getMonth()==2){
return "dmy";
}else{
return "mdy";
}
}
Greetings, Harm Meijer