Ejemplo n.º 1
0
 def _initFromYYYYMMDDHHMMSS(self,
                             year,
                             month,
                             day,
                             hour,
                             minute,
                             second,
                             tz=UTC_TIMEZONE):
     # Note: not sure about the millis param...
     dt = createDateTime(year, month, day, hour, minute, second, tz)
     self.dateTime = convertToUtcDateTime(dt)
Ejemplo n.º 2
0
 def _toRpcDateTime(self, date):
     u"""Converts the given date time to xml-rpc UTC time object.""" #$NON-NLS-1$
     date = convertToUtcDateTime(date)
     format = self._getParameters().getParameter(IZBlogApiParamConstants.DATEFORMAT_OUT)
     if not format:
         format = u"%Y%m%dT%H:%M:%SZ"  #$NON-NLS-1$
     # if not UTC, use local time
     if not format.endswith(u"Z"): #$NON-NLS-1$
         date = convertToLocalTime(date)
     xdts = date.strftime(str(format))
     xdt = zoundry.blogpub.xmlrpc.zpatch.xmlrpclib.DateTime(xdts)
     return xdt
Ejemplo n.º 3
0
 def _toRpcDateTime(self, date):
     u"""Converts the given date time to xml-rpc UTC time object."""  #$NON-NLS-1$
     date = convertToUtcDateTime(date)
     format = self._getParameters().getParameter(
         IZBlogApiParamConstants.DATEFORMAT_OUT)
     if not format:
         format = u"%Y%m%dT%H:%M:%SZ"  #$NON-NLS-1$
     # if not UTC, use local time
     if not format.endswith(u"Z"):  #$NON-NLS-1$
         date = convertToLocalTime(date)
     xdts = date.strftime(str(format))
     xdt = zoundry.blogpub.xmlrpc.zpatch.xmlrpclib.DateTime(xdts)
     return xdt
Ejemplo n.º 4
0
    def __init__(self, date = None):
        param = date
        if not date:
            param = getCurrentUtcDateTime()

        if isinstance(param, str) or isinstance(param, unicode):
            self._initFromString(param)
        elif isinstance(param, long) or isinstance(param, int):
            self._initFromLongMs(param)
        elif isinstance(param, datetime):
            self.dateTime = convertToUtcDateTime(param)
        else:
            raise ZException(_extstr(u"schematypes.SchemaDateTimeFormatError")) #$NON-NLS-1$
Ejemplo n.º 5
0
    def __init__(self, date=None):
        param = date
        if not date:
            param = getCurrentUtcDateTime()

        if isinstance(param, str) or isinstance(param, unicode):
            self._initFromString(param)
        elif isinstance(param, long) or isinstance(param, int):
            self._initFromLongMs(param)
        elif isinstance(param, datetime):
            self.dateTime = convertToUtcDateTime(param)
        else:
            raise ZException(_extstr(
                u"schematypes.SchemaDateTimeFormatError"))  #$NON-NLS-1$
Ejemplo n.º 6
0
 def _initFromYYYYMMDDHHMMSS(self, year, month, day, hour, minute, second, tz = UTC_TIMEZONE):
     # Note: not sure about the millis param...
     dt = createDateTime(year, month, day, hour, minute, second, tz)
     self.dateTime = convertToUtcDateTime(dt)