Posts tagged ‘datetimes’

Postgres sql basic querying based on datetime

For the benefit of google (and me when I’m using google)

In postgres and probably most other SQLs the following

SELECT * FROM table where creation_date > timestamp 'now' - interval '2 hours';

finds all records that were created in the last 2 hours.

See also:
http://www.postgresql.org/docs/8.0/static/datatype-datetime.html

Advertisements

March 11, 2010 at 9:29 pm Leave a comment

Human readable datetimes in python’s django

For the benefit of google (and me when I’m searching). To create human readable dates, datetimes and timestamps in django’s templating language one can use the timesince filter like so

This happened {{ object.creation_date|timesince }} ago

March 11, 2010 at 9:11 pm Leave a comment


December 2017
M T W T F S S
« Nov    
 123
45678910
11121314151617
18192021222324
25262728293031