import java.util.Date; import com.ocpsoft.pretty.time.PrettyTime; public class BasicJavaApp { public static void main(String[] args) { PrettyTime p = new PrettyTime(Locale.CHINESE); System.out.println(p.format(new Date())); } }//源代码片段来自云代码http://yuncode.net private final static PrettyTime PRETTY_TIME = new PrettyTime(Locale.CHINESE); static{ PRETTY_TIME.removeUnit(JustNow.class); PRETTY_TIME.removeUnit(Second.class); PRETTY_TIME.removeUnit(Millisecond.class); }//源代码片段来自云代码http://yuncode.net