Detect if the post was published less than 2 months ago

I was to associated a special class to a post that has been published less than 2 months ago.
How can I detect that? get_the_time extracts a string. Can I return a datetime object? Thanks.