Is the toString() method in java.util.Date locale independent? -
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 api tells me java.util.date.tostring() format "dow mon dd hh:mm:ss zzz yyyy", want know if content format of tostring() change while windows locale changed? such "russian","english", suggest input same, checkdate value same? help.
date.tostring() locale independent. significant change can ever observe timezone, depends on timezone settings of computer. by design.
converts date object string of form:
dow mon dd hh:mm:ss zzz yyyywhere:
dowday of week (sun,mon,tue,wed,thu,fri,sat).monmonth (jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec).ddday of month (01through31), 2 decimal digits.hhhour of day (00through23), 2 decimal digits.mmminute within hour (00through59), 2 decimal digits.sssecond within minute (00through61, 2 decimal digits.zzztime zone (and may reflect daylight saving time). standard time zone abbreviations include recognized method parse. if time zone information not available,zzzempty - is, consists of no characters @ all.yyyyyear, 4 decimal digits.