I’ve got a field on an object, ‘timestamp’ which looks like this in the database:
2012-03-18 12:47:01
I’m trying to write a condition into my Django template that looks at two objects’ timestamps, and compares them. Essentially, what I’m looking for is this..
If objectB.timestamp > objectA.timestamp + 10 minutes
do whatever
else
do something else
The problem I’m running into is I can’t add to the timestamp. Any thoughts? I tried truncating the time, but that works from the backside. I tried cutting out digits and truncating, but that’s not really a working solution. Any thoughts?
Is there a way to truncate from the front?
That should be custom tag or filter. For adding and subtracting datetimes use timedelta.