Back to index

plone3  3.1.7
Functions
ATContentTypes.utils Namespace Reference

Functions

def dt2DT
def DT2dt
def toTime
def toSeconds

Function Documentation

Convert Python's datetime to Zope's DateTime

Definition at line 26 of file utils.py.

00026 
00027 def dt2DT(date):
00028     """Convert Python's datetime to Zope's DateTime
00029     """
00030     return DateTime(*date.timetuple()[:6])

Here is the caller graph for this function:

Convert Zope's DateTime to Pythons's datetime

Definition at line 31 of file utils.py.

00031 
00032 def DT2dt(date):
00033     """Convert Zope's DateTime to Pythons's datetime
00034     """
00035     # seconds (parts[6]) is a float, so we map to int
00036     args = map(int, date.parts()[:6])
00037     return datetime.datetime(*args)

Here is the caller graph for this function:

Converts a timedelta to an integer representing the number of seconds

Definition at line 45 of file utils.py.

00045 
00046 def toSeconds(td):
00047     """Converts a timedelta to an integer representing the number of seconds
00048     """
00049     return td.seconds + td.days * 86400
get time part of a date

Definition at line 38 of file utils.py.

00038 
00039 def toTime(date):
00040     """get time part of a date
00041     """
00042     if isinstance(date, datetime.datetime):
00043         date = dt2DT(date)
00044     return date.Time()

Here is the call graph for this function: