Migrate code use Calendar class to represent date and time.