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 yyyy
where:
dow
day of week (sun
,mon
,tue
,wed
,thu
,fri
,sat
).mon
month (jan
,feb
,mar
,apr
,may
,jun
,jul
,aug
,sep
,oct
,nov
,dec
).dd
day of month (01
through31
), 2 decimal digits.hh
hour of day (00
through23
), 2 decimal digits.mm
minute within hour (00
through59
), 2 decimal digits.ss
second within minute (00
through61
, 2 decimal digits.zzz
time zone (and may reflect daylight saving time). standard time zone abbreviations include recognized method parse. if time zone information not available,zzz
empty - is, consists of no characters @ all.yyyy
year, 4 decimal digits.