-
PrettyTime: Social-style time formatting for Java (8 messages)
- Posted by: Lincoln Baxter III
- Posted on: June 18 2009 06:54 EDT
You can also follow @ocpsoft and @lincolnthree on twitter for more updates on PrettyTime Simple example of PrettyTime in Action: ---------------------------------------------------------- import java.util.Date; import com.ocpsoft.pretty.time.PrettyTime; public class BasicJavaApp { public static void main(String[] args) { PrettyTime p = new PrettyTime(); System.out.println(p.format(new Date())); } } --------------------------------------------------------- Prints: "right now" --------------------------------------------------------- Easy! Visit the PrettyTime website for downloads and more information. Other open-source libraries from @ocpsoft -- PrettyFaces -- bookmarkable URLs for JSF1.2 and JSF2.0Threaded Messages (8)
- I18n? by Alexandros Paramythis on June 18 2009 09:33 EDT
- i18n by Lincoln Baxter III on June 18 2009 10:34 EDT
- i18n = very useful, no 18n = useless by Scott Mueller on June 18 2009 01:56 EDT
- not my case by Daniil Liberman on June 19 2009 06:25 EDT
- Re: not my case by Raghunathan Semburakkiannan on June 19 2009 04:34 EDT
- i18n by Lincoln Baxter III on June 18 2009 10:34 EDT
- Re: PrettyTime: Social-style time formatting for Java by Alan Roche on June 19 2009 06:01 EDT
- i18n by Pavel Kaplin on June 23 2009 10:36 EDT
- Time period by Pavel Kaplin on June 23 2009 10:39 EDT
-
I18n?[ Go to top ]
- Posted by: Alexandros Paramythis
- Posted on: June 18 2009 09:33 EDT
- in response to Lincoln Baxter III
The library looks interesting, but it's a pity one would need to shoe-horn internationalization on top of it. -
i18n[ Go to top ]
- Posted by: Lincoln Baxter III
- Posted on: June 18 2009 10:34 EDT
- in response to Alexandros Paramythis
i18n is in the works -- never fear -- suggestions welcome, also. -
i18n = very useful, no 18n = useless[ Go to top ]
- Posted by: Scott Mueller
- Posted on: June 18 2009 13:56 EDT
- in response to Lincoln Baxter III
I would absolutely use this library if i18n was supported. Simply allow message.properties phrases to be used so we can provide our own translations for all the different possible time outputs. -
not my case[ Go to top ]
- Posted by: Daniil Liberman
- Posted on: June 19 2009 06:25 EDT
- in response to Alexandros Paramythis
PrettyTime p = new PrettyTime(); System.out.println(p.format(new Date())); causes Exception in thread "main" java.lang.ArithmeticException: / by zero at com.ocpsoft.pretty.time.PrettyTime.calculateDuration(PrettyTime.java:114) at com.ocpsoft.pretty.time.PrettyTime.approximateDuration(PrettyTime.java:85) at com.ocpsoft.pretty.time.PrettyTime.format(PrettyTime.java:192) at de.dani.experiments.demos.prettytime.PrettyTimeDemo.main(PrettyTimeDemo.java:11) -
Re: not my case[ Go to top ]
- Posted by: Raghunathan Semburakkiannan
- Posted on: June 19 2009 16:34 EDT
- in response to Daniil Liberman
Nice finding..this is how the application need to improved. I know many people wrote their own logic to achieve this. This sort of simple tools/API makes development time faster and more over we don't have to think too much on all use-cases(already tested by many people). Contribution & sharing is well appreciated ! -
Re: PrettyTime: Social-style time formatting for Java[ Go to top ]
- Posted by: Alan Roche
- Posted on: June 19 2009 06:01 EDT
- in response to Lincoln Baxter III
Looks like a simple and useful API. I can see people using this. Well done. -
i18n[ Go to top ]
- Posted by: Pavel Kaplin
- Posted on: June 23 2009 10:36 EDT
- in response to Lincoln Baxter III
+1 for i18n, able to help with Russian and Ukrainian versions. Feel free to contact me. -
Time period[ Go to top ]
- Posted by: Pavel Kaplin
- Posted on: June 23 2009 10:39 EDT
- in response to Lincoln Baxter III
Another idea is to provide similar formatter for time periods. E.g. "2 days", "15 minutes" etc. How about this?