An immutable type for working with MediaWiki timestamps in their various forms.
Parameters: |
|
---|---|
Returns: |
You can make use of a lot of different time things to initialize a mw.Timestamp.
For example:
>>> import datetime, time
>>> from mw import Timestamp
>>> Timestamp(1234567890)
Timestamp('2009-02-13T23:31:30Z')
>>> Timestamp(1234567890) == Timestamp("2009-02-13T23:31:30Z")
True
>>> Timestamp(1234567890) == Timestamp("20090213233130")
True
>>> Timestamp(1234567890) == Timestamp(datetime.datetime.utcfromtimestamp(1234567890))
True
>>> Timestamp(1234567890) == Timestamp(time.strptime("2009-02-13T23:31:30Z", "%Y-%m-%dT%H:%M:%SZ"))
True
>>> Timestamp(1234567890) == Timestamp(Timestamp(1234567890))
True
You can also do math and comparisons of timestamps.:
>>> from mw import Timestamp
>>> t = Timestamp(1234567890)
>>> t
Timestamp('2009-02-13T23:31:30Z')
>>> t2 = t + 10
>>> t2
Timestamp('2009-02-13T23:31:40Z')
>>> t += 1
>>> t
Timestamp('2009-02-13T23:31:31Z')
>>> t2 - t
9
>>> t < t2
True
Constructs a mw.Timestamp from a datetime.datetime.
Parameters: |
|
---|---|
Returns: |
Constructs a mw.Timestamp from a MediaWiki formatted string. This method is provides a convenient way to construct from common MediaWiki timestamp formats. E.g., %Y%m%d%H%M%S and %Y-%m-%dT%H:%M:%SZ.
Parameters: |
|
---|---|
Returns: |
Constructs a mw.Timestamp from a time.time_struct.
Parameters: |
|
---|---|
Returns: |
Constructs a mw.Timestamp from a unix timestamp (in seconds since Jan. 1st, 1970 UTC).
Parameters: |
|
---|---|
Returns: |
Constructs a long, '%Y-%m-%dT%H:%M:%SZ' formatted string common to the API. This method is roughly equivalent to calling strftime('%Y-%m-%dT%H:%M:%SZ').
Parameters: |
|
---|---|
Returns: | A formatted string |
Constructs a long, '%Y%m%d%H%M%S' formatted string common to the database. This method is roughly equivalent to calling strftime('%Y%m%d%H%M%S').
Parameters: |
|
---|---|
Returns: | A formatted string |
Constructs a formatted string. See https://docs.python.org/3/library/time.html#time.strftime for a discussion of formats descriptors.
Parameters: |
|
---|---|
Returns: | A formatted string |
Constructs a mw.Timestamp from an explicitly formatted string. See https://docs.python.org/3/library/time.html#time.strftime for a discussion of formats descriptors.
Parameters: |
|
---|---|
Returns: |
Returns: | the number of seconds since Jan. 1st, 1970 UTC. |
---|
Namespace meta data.
Alias names : set( str )
Canonical name : str | None
Case sensitivity : str | None
Is considered a content namespace : bool
Constructs a namespace object from a namespace doc returned by the API site_info call.
Namespace ID : int
Namespace name : str