MxDateTime - Date/Time Library for Python

mxDateTime

Date/Time Library

for Python

Veersion

rsion 3

.1

3.1

Copyright ? 1997-2000 by IKDS Marc-Andr¨¦ Lemburg, Langenfeld

Copyright ? 2000-2008 by GmbH, Langenfeld

All rights reserved. No part of this work may be reproduced or used in a any form or

by any means without written permission of the publisher.

All product names and logos are trademarks of their respective owners. The product

names "mxBeeBase", "mxCGIPython", "mxCounter", "mxCrypto", "mxDateTime",

"mxHTMLTools", "mxLicenseManager", "mxLog", "mxNumber", "mxODBC",

"mxObjectStore", "mxProxy", "mxQueue", "mxStack", "mxTextTools", "mxTidy",

"mxTools", "mxUID", "mxURL", "mxXMLTools", "eGenix Application Server",

"PythonHTML", "eGenix" and "" and corresponding logos are trademarks of

GmbH, Langenfeld.

Printed in Germany.

Contents

Contents

1.

Introduction .................................................................................................. 1

2.

Design........................................................................................................... 2

2.1

Time Zones, Daylight Savings Time (DST) and Leap Seconds ................ 3

2.2

Calendars .............................................................................................. 3

2.3

Conversion from and to other formats................................................... 4

2.4

Rounding Errors and Roundtrip-Safety ................................................... 4

2.5

Immutability .......................................................................................... 4

2.6

UTC and GMT ....................................................................................... 5

2.7

Interaction with other Types .................................................................. 5

2.8

String formats........................................................................................ 5

2.9

Speed and Memory ............................................................................... 6

2.10 Background and Resource Information on the Web............................... 6

3.

4.

5.

mx.DateTime.DateTime Object...................................................................... 7

3.1

DateTime Object Constructors .............................................................. 7

3.2

DateTime Object Methods .................................................................. 11

3.3

DateTime Object Attributes ................................................................. 13

mx.DateTime.DateTimeDelta Object ............................................................16

4.1

DateTimeDelta Object Constructors.................................................... 16

4.2

DateTimeDelta Object Methods .......................................................... 17

4.3

DateTimeDelta Object Attributes......................................................... 18

mx.DateTime.RelativeDateTime Object.........................................................19

5.1

RelativeDateTime Constructors ........................................................... 19

5.2

RelativeDateTime Object Methods ...................................................... 21

5.3

RelativeDateTime Object Attributes..................................................... 21

mxDateTime - Date/Time Library for Python

5.4

RelativeDateTime Object Usage........................................................... 21

6.

mx.DateTime Functions ............................................................................... 24

7.

mx.DateTime Constants............................................................................... 25

8.

Date/Time Arithmetic................................................................................... 27

8.1

9.

Notes:.................................................................................................. 31

mxDateTime Submodules ............................................................................ 32

9.1

mx.DateTime.ISO Submodule.............................................................. 32

9.1.1 Constructors & Functions .......................................................... 32

Notes......................................................................................... 34

9.1.2 ISO 8601 string formats and DateTime[Delta] instances ........... 34

9.2

mx.DateTime.ARPA Submodule ........................................................... 35

9.2.1 Constructors & Functions .......................................................... 35

Notes......................................................................................... 36

9.3

mx.DateTime.Feasts Submodule.......................................................... 36

9.3.1 Constructors & Functions .......................................................... 36

9.4

mx.DateTime.Parser Submodule.......................................................... 37

9.4.1 Constructors & Functions .......................................................... 38

9.5

mx.DateTime.NIST Submodule ............................................................ 40

9.5.1 Constructors & Functions .......................................................... 40

9.5.2 Constants .................................................................................. 42

9.5.3 Examples ................................................................................... 43

10.

Examples of Use .......................................................................................... 44

11.

mx.DateTime Python C-API.......................................................................... 45

12.

mxDateTime Package Structure.................................................................... 46

13.

Support ....................................................................................................... 47

14.

Copyright & License .................................................................................... 48

1. Introduction

1.

Introduction

The mxDateTime package provides consistent way of transferring date and

time data between Python and databases.

Apart from handling dates before the Unix epoch (1.1.1970) they also

correctly work with dates beyond the Unix time limit (currently with Unix

time values being commonly encoded using 32bit integers, the limit is

reached in 2038) and thus is Year 2000 and Year 2038 safe.

The package provides three main data structures for working with date and

time values.

These are:

?

DateTime for referring to absolute date/time values,

?

DateTimeDelta for date/time spans and

?

RelativeDateTime for representing variable date/time spans (these

are the TABs of date/time calculation)

All object, functions and constants are available via the package namespace

mx.DateTime.

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download