src/cm/utils/date.py
author rbernard
Fri, 05 Feb 2010 18:43:58 +0100
changeset 154 8cb89c153140
parent 0 40c8f766c9b8
permissions -rw-r--r--
bug fix: removed \r in textversion's content because of a comment position bug in pre_edit. Added a save function to TextVersionManager to do so. Also removed cleaning \r before computing diffs because it should not be necessary anymore.

import time
from django.utils.translation import ugettext as _

#http://docs.python.org/lib/module-time.html
def datetime_to_user_str(dt):
    return dt.strftime(str(_("%Y-%m-%d %H:%M"))) 

#def datetime_to_str(dt):
#    return dt.strftime(CLIENT_DATE_FMT['python_output'])

def datetime_to_epoch(dt):
    return time.mktime(dt.timetuple())

#def datetime_to_js_date_str(dt):
#    print str(1000*mktime(dt.timetuple()))
#    return str(1000*mktime(dt.timetuple()))