Posts

#Python Convert datetime to Unix Epoch Timestamp

There doesn’t seem to be a way to get a Unix timestamp directly from a datetime object in Python, the best workaround example I could find is:

 
from datetime import datetime
import time
now = datetime.now()
u = str(long(time.mktime(now.timetuple())))

This gets the timestamp as a string, it seems a bit long winded, so if anybody knows a better way please let me know!

 

Drupal cron setup on blacknight.ie unix plan

For setting up a Drupal maintenance cron job on the blacknight.ie unix hosting plan, I have found that the following command works well:

 

/usr/bin/wget -O – -q -t 1 http://www.yourdomain.com/cron.php

 

Original Source: http://drupal.org/cron