How can I compare if two DateTime objects have the same day,month and year?
The problem is they have different hours/min/seconds.
How can I compare if two DateTime objects have the same day,month and year?
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.
There’s no nice way of doing that with DateTime objects. So you’ll have to do, lets say, not so nice things.
This will work, but like I said, it’s not nice.
On a side note, recent experience tells me its always best to make sure both dates are on the same timezone, so I added the code for it just in case.