Here is a post that answers a similar question, at the date level.
You might be able to build on that.