Package pyxb :: Package binding :: Module datatypes :: Class dateTime
[hide private]
[frames] | no frames]

Class dateTime

source code

                    object --+                        
                             |                        
                       cscRoot --+                    
                                 |                    
     utils.utility.Locatable_mixin --+                
                                     |                
              basis._TypeBinding_mixin --+            
                                         |            
                            object --+   |            
                                     |   |            
utils.utility._DeconflictSymbols_mixin --+            
                                         |            
                        object --+       |            
                                 |       |            
                           cscRoot --+   |            
                                     |   |            
            basis._DynamicCreate_mixin --+            
                                         |            
                basis.simpleTypeDefinition --+        
                                             |        
                            _PyXBDateTime_base --+    
                                                 |    
                            _PyXBDateTimeZone_base --+
                                                     |
                                    object --+       |
                                             |       |
                                 datetime.date --+   |
                                                 |   |
                                 datetime.datetime --+
                                                     |
                                                    dateTime

XMLSchema datatype dateTime.

This class uses the Python datetime.datetime class as its underlying representation. Note that per the XMLSchema spec, all dateTime objects are in UTC, and that timezone information in the string representation in XML is an indication of the local time zone's offset from UTC. Presence of time zone information in the lexical space is preserved through the value of the hasTimeZone() field.


Warning: The value space of Python's datetime.datetime class is more restricted than that of xs:datetime. As a specific example, Python does not support negative years or years with more than four digits. For now, the convenience of having an object that is compatible with Python is more important than supporting the full value space. In the future, the choice may be left up to the developer.

Nested Classes [hide private]
  _XsdBaseType
XMLSchema datatype anySimpleType.
Instance Methods [hide private]
datetime.datetime (NOT xsd.dateTime)
aslocal(self)
Returns a datetime.datetime instance denoting the same time as this instance but adjusted to be in the local time zone.
source code

Inherited from _PyXBDateTimeZone_base: hasTimeZone

Inherited from _PyXBDateTimeZone_base (private): _setHasTimeZone

Inherited from basis.simpleTypeDefinition: __init__, pythonLiteral, xsdConstraintsOK, xsdLiteral, xsdValueLength

Inherited from basis._TypeBinding_mixin: __setattr__, toDOM, toxml, validateBinding

Inherited from datetime.datetime: __add__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __le__, __lt__, __ne__, __radd__, __reduce__, __repr__, __rsub__, __str__, __sub__, astimezone, combine, ctime, date, dst, fromtimestamp, isoformat, now, replace, strptime, time, timetuple, timetz, tzname, utcfromtimestamp, utcnow, utcoffset, utctimetuple

Inherited from datetime.date: __format__, fromordinal, isocalendar, isoweekday, strftime, toordinal, weekday

Inherited from object: __delattr__, __reduce_ex__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
XsdLiteral(cls, value)
Convert from a python value to a string usable in an XML document.
source code
 
today(cls)
Return today.
source code

Inherited from basis.simpleTypeDefinition: PythonLiteral, SimpleTypeDefinition, XsdConstraintsOK, XsdSuperType, XsdValueLength

Inherited from basis._TypeBinding_mixin: Factory

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kw) source code
Class Variables [hide private]
  _ExpandedName = pyxb.namespace.XMLSchema.createExpandedName('d...
The expanded name of the component.
  __Lexical_re = re.compile(r'^(?P<negYear>-?)(?P<year>\d{4,})-(...
  __Fields = ('year', 'month', 'day', 'hour', 'minute', 'second'...
  __UTCZone = pyxb.utils.utility.UTCOffsetTimeZone(0)
  __LocalZone = pyxb.utils.utility.LocalTimeZone()
  _CF_enumeration = <pyxb.binding.facets.CF_enumeration object a...
  _CF_maxExclusive = <pyxb.binding.facets.CF_maxExclusive object...
  _CF_maxInclusive = <pyxb.binding.facets.CF_maxInclusive object...
  _CF_minExclusive = <pyxb.binding.facets.CF_minExclusive object...
  _CF_minInclusive = <pyxb.binding.facets.CF_minInclusive object...
  _CF_pattern = <pyxb.binding.facets.CF_pattern object at 0x1378...
  _CF_whiteSpace = <pyxb.binding.facets.CF_whiteSpace object at ...
  __SimpleTypeDefinition = <pyxb.xmlschema.structures.SimpleType...
  _httpwww_w3_org2001XMLSchema_dateTime_FacetMap = {<class 'pyxb...

Inherited from basis.simpleTypeDefinition (private): _ReservedSymbols

Inherited from datetime.datetime: max, min, resolution

Properties [hide private]

Inherited from datetime.datetime: hour, microsecond, minute, second, tzinfo

Inherited from datetime.date: day, month, year

Inherited from object: __class__

Method Details [hide private]

__new__(cls, *args, **kw)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

XsdLiteral(cls, value)
Class Method

source code 

Convert from a python value to a string usable in an XML document.

This should be implemented in the subclass.

Overrides: basis.simpleTypeDefinition.XsdLiteral
(inherited documentation)

today(cls)
Class Method

source code 

Return today.

Just like datetime.datetime.today(), except this one sets a tzinfo field so it's clear the value is UTC.

Overrides: datetime.date.today

Class Variable Details [hide private]

_ExpandedName

The expanded name of the component.

Value:
pyxb.namespace.XMLSchema.createExpandedName('dateTime')

__Lexical_re

Value:
re.compile(r'^(?P<negYear>-?)(?P<year>\d{4,})-(?P<month>\d{2})-(?P<day\
>\d{2})T(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2})(?P<fracsec\
>\.\d+)?(?P<tzinfo>Z|[-\+]\d\d:\d\d)?$')

__Fields

Value:
('year',
 'month',
 'day',
 'hour',
 'minute',
 'second',
 'microsecond',
 'tzinfo')

_CF_enumeration

Value:
<pyxb.binding.facets.CF_enumeration object at 0x1378310>

_CF_maxExclusive

Value:
<pyxb.binding.facets.CF_maxExclusive object at 0x1378410>

_CF_maxInclusive

Value:
<pyxb.binding.facets.CF_maxInclusive object at 0x1378450>

_CF_minExclusive

Value:
<pyxb.binding.facets.CF_minExclusive object at 0x1378350>

_CF_minInclusive

Value:
<pyxb.binding.facets.CF_minInclusive object at 0x13783d0>

_CF_pattern

Value:
<pyxb.binding.facets.CF_pattern object at 0x13782d0>

_CF_whiteSpace

Value:
<pyxb.binding.facets.CF_whiteSpace object at 0x1378390>

__SimpleTypeDefinition

Value:
<pyxb.xmlschema.structures.SimpleTypeDefinition object at 0x1afd4d0>

_httpwww_w3_org2001XMLSchema_dateTime_FacetMap

Value:
{<class 'pyxb.binding.facets.CF_whiteSpace'>: <pyxb.binding.facets.CF_\
whiteSpace object at 0x1378390>,
 <class 'pyxb.binding.facets.CF_minInclusive'>: <pyxb.binding.facets.C\
F_minInclusive object at 0x13783d0>,
 <class 'pyxb.binding.facets.CF_maxInclusive'>: <pyxb.binding.facets.C\
F_maxInclusive object at 0x1378450>,
 <class 'pyxb.binding.facets.CF_minExclusive'>: <pyxb.binding.facets.C\
F_minExclusive object at 0x1378350>,
...