What is the purpose of having Date and Time classes when there is a DateTime class that can handle both?
What is the purpose of having Date and Time classes when there is a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DateTimeis a subclass ofDate, so whatever you can do withDatecan be done withDateTime. But as tadman and steenslag point out,DateTimeis slower. See steenslag’s answer for how much slower it is.With respect to
DateTimevs,Time, I found something here:In short,
DateTimeis an all around superstar, and should be preferred in general, but if you want to optimize to the last bit, usingTimecan improve performance.