On 13/03/2008, Oberhuber, Martin <[EMAIL PROTECTED]> wrote: > What about this: > > 1.) Use REGEX to parse year into a separate String -> will be empty or nnnn
Regex is not available in Java 1.3. Also, how does one know where the year is in the string? [Adding the year is easy, because the format and the string can both have the year added at the end.] > 2.) If year is empty, substitute current year (as seen on client) and parse > the date > 2.1 If a parse error occurs, OR result date is > 3 days in the future, try > again with previous year > (in order to account for Jan.1 on the host where client still has Dec.31) > (allow 3 days in future to be safe in really odd timezone conditions) > 2.2 If previous year also gives a parse error then give up? > My Linux box (RHEL4) currently shows > "Sep 27 17:28" for Sep 27, 2007 > "Sep 3 2007" for Sep 3, 2007 > "Mar 15 2008" for Mar 15, 2008 > > So apparently it uses short dates only for 6 months back. > And doesn't use short dates for future dates even if it's > Just 2 days in the future. Useful to know. > I think that the FTP solution should work properly for the most > Prevalent system and live with the fact that we don't know if The code is designed to handle lots of different OSes. I don't think it's fair to only support the commonest one. > There are any obscure OS's there which keep using short dates > Even 10 months or more after the date. It's just undefined. > > Correct solution will come by using new FTP MDTM / MLST commands. Indeed. > Cheers, > -- > Martin Oberhuber, Senior Member of Technical Staff, Wind River > Target Management Project Lead, DSDP PMC Member > http://www.eclipse.org/dsdp/tm > > > > > > -----Original Message----- > > From: sebb [mailto:[EMAIL PROTECTED] > > Sent: Mittwoch, 12. März 2008 21:37 > > To: Commons Developers List > > Subject: [NET] 1.5 Leap year processing > > > > I think I've found a solution to the leap year processing. > > > > At present the code tries the short date and then adds the current > > year if the parse fails. > > This does not work on Java 1.4 or earlier because Feb 29 1970 does not > > cause a parse failure - the date is converted to Mar 1 1970. > > > > One solution seems to be to add the current year to the short date > > initially, so Feb 29 will either parse OK or cause a failure if it's > > not a leap year; the date won't be changed to Mar 1. > > > > However, I've just realised that it won't work if the current date is > > in Jan or Feb the following year, i.e. 10+ months later. > > > > Are there any OSes which display short dates more than 10 months after > > the file date? > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]