Is there an easy way to create a timestamp, in XML Schema format?
datetime.datetime.now()
does not work.
.now(): 2012-02-17 09:52:35.033232
Desired: 2012-02-15T14:18:46.295-02:00
Looks pretty much the same, but fails on schema validation.
The correct answer is A (xs:date) and C (xs:gMonthDay). These two are embedded simple types representing time and date under XML Schema.
tzinfo is an abstract base class. It cannot be instantiated directly. A concrete subclass has to derive it and implement the methods provided by this abstract class. The instance of the tzinfo class can be passed to the constructors of the datetime and time objects.
If you want a fixed default date, you should be able to use the "defaultvalue" tag in your *-items. xml file. If you want to have a some kind of a dynamic default date (maybe with some business logic) you can use an interceptor.
>>> datetime.datetime.now(pytz.utc).isoformat()
'2012-02-17T11:58:44.789024+00:00'
>>> datetime.datetime.now(pytz.timezone('Europe/Paris')).isoformat()
'2012-02-17T13:00:10.885743+01:00'
apply your own time zone if needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With