try {
SimpleDateFormat strTemp = new SimpleDateFormat("ddMMMyy", Locale.US);
Date reasult = strTemp.parse(input);
String checkDate = reasult.toString().substring(8, 10) + reasult.toString().substring(4, 7) + reasult.toString().substring(26);
if (!checkDate.toUpperCase().equals(input))
return false;
else
return true;
} catch (Exception ex) {
return false;
}
As the API tells me java.util.Date.toString() is like format "dow mon dd hh:mm:ss zzz yyyy", I just want to know if the content format of toString() will be change while the windows locale changed? Such as "Russian","English", suggest the input is same, the checkDate value is same? Thanks for you help.
Date.toString() is locale independent. The most significant change that you can ever observe is the timezone, which depends on the timezone settings of your computer. This is by design.
Converts this Date object to a String of the form:
dow mon dd hh:mm:ss zzz yyyywhere:
dowis the day of the week (Sun,Mon,Tue,Wed,Thu,Fri,Sat).monis the month (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec).ddis the day of the month (01through31), as two decimal digits.hhis the hour of the day (00through23), as two decimal digits.mmis the minute within the hour (00through59), as two decimal digits.ssis the second within the minute (00through61, as two decimal digits.zzzis the time zone (and may reflect daylight saving time). Standard time zone abbreviations include those recognized by the method parse. If time zone information is not available, thenzzzis empty - that is, it consists of no characters at all.yyyyis the year, as four decimal digits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With