import io.github.zhtmf.annotations.modifiers.DateFormatter; import io.github.zhtmf.annotations.modifiers.FormatPattern; import io.github.zhtmf.annotations.types.Date; import io.github.zhtmf.annotations.types.Numeric; import io.github.zhtmf.converters.auxiliary.ModifierHandler; public class MomentDemo { @Numeric(order = 1) private int id; @Date(order = 2) @FormatPattern("yyyy-MM-dd") @DateFormatter(converter=ModifierHandler.class) private java.util.Date dateOfBirth; public static void main(String[] args) { MomentDemo demo = new MomentDemo(); demo.setId(1); demo.setDateOfBirth(new java.util.Date()); String formattedDate = Moment.format(demo.getDateOfBirth(), "yyyy-MM-dd"); System.out.println("Formatted Date: " + formattedDate); java.util.Date parsedDate = Moment.parse("2022-01-01", "yyyy-MM-dd"); System.out.println("Parsed Date: " + parsedDate); int comparison = Moment.compare(demo.getDateOfBirth(), parsedDate); System.out.println("Comparison Result: " + comparison); } }


上一篇:
下一篇:
切换中文