annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/DateTime-5.5.dist-info/METADATA @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 Metadata-Version: 2.1
jpayne@68 2 Name: DateTime
jpayne@68 3 Version: 5.5
jpayne@68 4 Summary: This package provides a DateTime data type, as known from Zope. Unless you need to communicate with Zope APIs, you're probably better off using Python's built-in datetime module.
jpayne@68 5 Home-page: https://github.com/zopefoundation/DateTime
jpayne@68 6 Author: Zope Foundation and Contributors
jpayne@68 7 Author-email: zope-dev@zope.org
jpayne@68 8 License: ZPL 2.1
jpayne@68 9 Classifier: Development Status :: 6 - Mature
jpayne@68 10 Classifier: Environment :: Web Environment
jpayne@68 11 Classifier: Framework :: Zope :: 4
jpayne@68 12 Classifier: License :: OSI Approved :: Zope Public License
jpayne@68 13 Classifier: Operating System :: OS Independent
jpayne@68 14 Classifier: Programming Language :: Python
jpayne@68 15 Classifier: Programming Language :: Python :: 3
jpayne@68 16 Classifier: Programming Language :: Python :: 3.7
jpayne@68 17 Classifier: Programming Language :: Python :: 3.8
jpayne@68 18 Classifier: Programming Language :: Python :: 3.9
jpayne@68 19 Classifier: Programming Language :: Python :: 3.10
jpayne@68 20 Classifier: Programming Language :: Python :: 3.11
jpayne@68 21 Classifier: Programming Language :: Python :: 3.12
jpayne@68 22 Classifier: Programming Language :: Python :: Implementation :: CPython
jpayne@68 23 Classifier: Programming Language :: Python :: Implementation :: PyPy
jpayne@68 24 Requires-Python: >=3.7
jpayne@68 25 License-File: LICENSE.txt
jpayne@68 26 Requires-Dist: zope.interface
jpayne@68 27 Requires-Dist: pytz
jpayne@68 28
jpayne@68 29 .. image:: https://github.com/zopefoundation/DateTime/workflows/tests/badge.svg
jpayne@68 30 :target: https://github.com/zopefoundation/DateTime/actions?query=workflow%3Atests
jpayne@68 31 :alt: CI status
jpayne@68 32
jpayne@68 33 .. image:: https://img.shields.io/pypi/v/DateTime.svg
jpayne@68 34 :target: https://pypi.org/project/DateTime/
jpayne@68 35 :alt: Current version on PyPI
jpayne@68 36
jpayne@68 37 .. image:: https://img.shields.io/pypi/pyversions/DateTime.svg
jpayne@68 38 :target: https://pypi.org/project/DateTime/
jpayne@68 39 :alt: Supported Python versions
jpayne@68 40
jpayne@68 41
jpayne@68 42 DateTime
jpayne@68 43 ========
jpayne@68 44
jpayne@68 45 This package provides a DateTime data type, as known from Zope.
jpayne@68 46
jpayne@68 47 Unless you need to communicate with Zope APIs, you're probably better
jpayne@68 48 off using Python's built-in datetime module.
jpayne@68 49
jpayne@68 50 For further documentation, please have a look at `src/DateTime/DateTime.txt`.
jpayne@68 51
jpayne@68 52
jpayne@68 53 .. contents::
jpayne@68 54
jpayne@68 55 The DateTime package
jpayne@68 56 ====================
jpayne@68 57
jpayne@68 58 Encapsulation of date/time values.
jpayne@68 59
jpayne@68 60
jpayne@68 61 Function Timezones()
jpayne@68 62 --------------------
jpayne@68 63
jpayne@68 64 Returns the list of recognized timezone names:
jpayne@68 65
jpayne@68 66 >>> from DateTime import Timezones
jpayne@68 67 >>> zones = set(Timezones())
jpayne@68 68
jpayne@68 69 Almost all of the standard pytz timezones are included, with the exception
jpayne@68 70 of some commonly-used but ambiguous abbreviations, where historical Zope
jpayne@68 71 usage conflicts with the name used by pytz:
jpayne@68 72
jpayne@68 73 >>> import pytz
jpayne@68 74 >>> [x for x in pytz.all_timezones if x not in zones]
jpayne@68 75 ['CET', 'EET', 'EST', 'MET', 'MST', 'WET']
jpayne@68 76
jpayne@68 77 Class DateTime
jpayne@68 78 --------------
jpayne@68 79
jpayne@68 80 DateTime objects represent instants in time and provide interfaces for
jpayne@68 81 controlling its representation without affecting the absolute value of
jpayne@68 82 the object.
jpayne@68 83
jpayne@68 84 DateTime objects may be created from a wide variety of string or
jpayne@68 85 numeric data, or may be computed from other DateTime objects.
jpayne@68 86 DateTimes support the ability to convert their representations to many
jpayne@68 87 major timezones, as well as the ability to create a DateTime object
jpayne@68 88 in the context of a given timezone.
jpayne@68 89
jpayne@68 90 DateTime objects provide partial numerical behavior:
jpayne@68 91
jpayne@68 92 * Two date-time objects can be subtracted to obtain a time, in days
jpayne@68 93 between the two.
jpayne@68 94
jpayne@68 95 * A date-time object and a positive or negative number may be added to
jpayne@68 96 obtain a new date-time object that is the given number of days later
jpayne@68 97 than the input date-time object.
jpayne@68 98
jpayne@68 99 * A positive or negative number and a date-time object may be added to
jpayne@68 100 obtain a new date-time object that is the given number of days later
jpayne@68 101 than the input date-time object.
jpayne@68 102
jpayne@68 103 * A positive or negative number may be subtracted from a date-time
jpayne@68 104 object to obtain a new date-time object that is the given number of
jpayne@68 105 days earlier than the input date-time object.
jpayne@68 106
jpayne@68 107 DateTime objects may be converted to integer, long, or float numbers
jpayne@68 108 of days since January 1, 1901, using the standard int, long, and float
jpayne@68 109 functions (Compatibility Note: int, long and float return the number
jpayne@68 110 of days since 1901 in GMT rather than local machine timezone).
jpayne@68 111 DateTime objects also provide access to their value in a float format
jpayne@68 112 usable with the Python time module, provided that the value of the
jpayne@68 113 object falls in the range of the epoch-based time module.
jpayne@68 114
jpayne@68 115 A DateTime object should be considered immutable; all conversion and numeric
jpayne@68 116 operations return a new DateTime object rather than modify the current object.
jpayne@68 117
jpayne@68 118 A DateTime object always maintains its value as an absolute UTC time,
jpayne@68 119 and is represented in the context of some timezone based on the
jpayne@68 120 arguments used to create the object. A DateTime object's methods
jpayne@68 121 return values based on the timezone context.
jpayne@68 122
jpayne@68 123 Note that in all cases the local machine timezone is used for
jpayne@68 124 representation if no timezone is specified.
jpayne@68 125
jpayne@68 126 Constructor for DateTime
jpayne@68 127 ------------------------
jpayne@68 128
jpayne@68 129 DateTime() returns a new date-time object. DateTimes may be created
jpayne@68 130 with from zero to seven arguments:
jpayne@68 131
jpayne@68 132 * If the function is called with no arguments, then the current date/
jpayne@68 133 time is returned, represented in the timezone of the local machine.
jpayne@68 134
jpayne@68 135 * If the function is invoked with a single string argument which is a
jpayne@68 136 recognized timezone name, an object representing the current time is
jpayne@68 137 returned, represented in the specified timezone.
jpayne@68 138
jpayne@68 139 * If the function is invoked with a single string argument
jpayne@68 140 representing a valid date/time, an object representing that date/
jpayne@68 141 time will be returned.
jpayne@68 142
jpayne@68 143 As a general rule, any date-time representation that is recognized
jpayne@68 144 and unambiguous to a resident of North America is acceptable. (The
jpayne@68 145 reason for this qualification is that in North America, a date like:
jpayne@68 146 2/1/1994 is interpreted as February 1, 1994, while in some parts of
jpayne@68 147 the world, it is interpreted as January 2, 1994.) A date/ time
jpayne@68 148 string consists of two components, a date component and an optional
jpayne@68 149 time component, separated by one or more spaces. If the time
jpayne@68 150 component is omitted, 12:00am is assumed.
jpayne@68 151
jpayne@68 152 Any recognized timezone name specified as the final element of the
jpayne@68 153 date/time string will be used for computing the date/time value.
jpayne@68 154 (If you create a DateTime with the string,
jpayne@68 155 "Mar 9, 1997 1:45pm US/Pacific", the value will essentially be the
jpayne@68 156 same as if you had captured time.time() at the specified date and
jpayne@68 157 time on a machine in that timezone). If no timezone is passed, then
jpayne@68 158 the timezone configured on the local machine will be used, **except**
jpayne@68 159 that if the date format matches ISO 8601 ('YYYY-MM-DD'), the instance
jpayne@68 160 will use UTC / GMT+0 as the timezone.
jpayne@68 161
jpayne@68 162 o Returns current date/time, represented in US/Eastern:
jpayne@68 163
jpayne@68 164 >>> from DateTime import DateTime
jpayne@68 165 >>> e = DateTime('US/Eastern')
jpayne@68 166 >>> e.timezone()
jpayne@68 167 'US/Eastern'
jpayne@68 168
jpayne@68 169 o Returns specified time, represented in local machine zone:
jpayne@68 170
jpayne@68 171 >>> x = DateTime('1997/3/9 1:45pm')
jpayne@68 172 >>> x.parts() # doctest: +ELLIPSIS
jpayne@68 173 (1997, 3, 9, 13, 45, ...)
jpayne@68 174
jpayne@68 175 o Specified time in local machine zone, verbose format:
jpayne@68 176
jpayne@68 177 >>> y = DateTime('Mar 9, 1997 13:45:00')
jpayne@68 178 >>> y.parts() # doctest: +ELLIPSIS
jpayne@68 179 (1997, 3, 9, 13, 45, ...)
jpayne@68 180 >>> y == x
jpayne@68 181 True
jpayne@68 182
jpayne@68 183 o Specified time in UTC via ISO 8601 rule:
jpayne@68 184
jpayne@68 185 >>> z = DateTime('2014-03-24')
jpayne@68 186 >>> z.parts() # doctest: +ELLIPSIS
jpayne@68 187 (2014, 3, 24, 0, 0, ...)
jpayne@68 188 >>> z.timezone()
jpayne@68 189 'GMT+0'
jpayne@68 190
jpayne@68 191 The date component consists of year, month, and day values. The
jpayne@68 192 year value must be a one-, two-, or four-digit integer. If a one-
jpayne@68 193 or two-digit year is used, the year is assumed to be in the
jpayne@68 194 twentieth century. The month may an integer, from 1 to 12, a month
jpayne@68 195 name, or a month abbreviation, where a period may optionally follow
jpayne@68 196 the abbreviation. The day must be an integer from 1 to the number of
jpayne@68 197 days in the month. The year, month, and day values may be separated
jpayne@68 198 by periods, hyphens, forward slashes, or spaces. Extra spaces are
jpayne@68 199 permitted around the delimiters. Year, month, and day values may be
jpayne@68 200 given in any order as long as it is possible to distinguish the
jpayne@68 201 components. If all three components are numbers that are less than
jpayne@68 202 13, then a month-day-year ordering is assumed.
jpayne@68 203
jpayne@68 204 The time component consists of hour, minute, and second values
jpayne@68 205 separated by colons. The hour value must be an integer between 0
jpayne@68 206 and 23 inclusively. The minute value must be an integer between 0
jpayne@68 207 and 59 inclusively. The second value may be an integer value
jpayne@68 208 between 0 and 59.999 inclusively. The second value or both the
jpayne@68 209 minute and second values may be omitted. The time may be followed
jpayne@68 210 by am or pm in upper or lower case, in which case a 12-hour clock is
jpayne@68 211 assumed.
jpayne@68 212
jpayne@68 213 * If the DateTime function is invoked with a single numeric argument,
jpayne@68 214 the number is assumed to be either a floating point value such as
jpayne@68 215 that returned by time.time(), or a number of days after January 1,
jpayne@68 216 1901 00:00:00 UTC.
jpayne@68 217
jpayne@68 218 A DateTime object is returned that represents either the GMT value
jpayne@68 219 of the time.time() float represented in the local machine's
jpayne@68 220 timezone, or that number of days after January 1, 1901. Note that
jpayne@68 221 the number of days after 1901 need to be expressed from the
jpayne@68 222 viewpoint of the local machine's timezone. A negative argument will
jpayne@68 223 yield a date-time value before 1901.
jpayne@68 224
jpayne@68 225 * If the function is invoked with two numeric arguments, then the
jpayne@68 226 first is taken to be an integer year and the second argument is
jpayne@68 227 taken to be an offset in days from the beginning of the year, in the
jpayne@68 228 context of the local machine timezone. The date-time value returned
jpayne@68 229 is the given offset number of days from the beginning of the given
jpayne@68 230 year, represented in the timezone of the local machine. The offset
jpayne@68 231 may be positive or negative. Two-digit years are assumed to be in
jpayne@68 232 the twentieth century.
jpayne@68 233
jpayne@68 234 * If the function is invoked with two arguments, the first a float
jpayne@68 235 representing a number of seconds past the epoch in GMT (such as
jpayne@68 236 those returned by time.time()) and the second a string naming a
jpayne@68 237 recognized timezone, a DateTime with a value of that GMT time will
jpayne@68 238 be returned, represented in the given timezone.
jpayne@68 239
jpayne@68 240 >>> import time
jpayne@68 241 >>> t = time.time()
jpayne@68 242
jpayne@68 243 Time t represented as US/Eastern:
jpayne@68 244
jpayne@68 245 >>> now_east = DateTime(t, 'US/Eastern')
jpayne@68 246
jpayne@68 247 Time t represented as US/Pacific:
jpayne@68 248
jpayne@68 249 >>> now_west = DateTime(t, 'US/Pacific')
jpayne@68 250
jpayne@68 251 Only their representations are different:
jpayne@68 252
jpayne@68 253 >>> now_east.equalTo(now_west)
jpayne@68 254 True
jpayne@68 255
jpayne@68 256 * If the function is invoked with three or more numeric arguments,
jpayne@68 257 then the first is taken to be an integer year, the second is taken
jpayne@68 258 to be an integer month, and the third is taken to be an integer day.
jpayne@68 259 If the combination of values is not valid, then a DateTimeError is
jpayne@68 260 raised. One- or two-digit years up to 69 are assumed to be in the
jpayne@68 261 21st century, whereas values 70-99 are assumed to be 20th century.
jpayne@68 262 The fourth, fifth, and sixth arguments are floating point, positive
jpayne@68 263 or negative offsets in units of hours, minutes, and days, and
jpayne@68 264 default to zero if not given. An optional string may be given as
jpayne@68 265 the final argument to indicate timezone (the effect of this is as if
jpayne@68 266 you had taken the value of time.time() at that time on a machine in
jpayne@68 267 the specified timezone).
jpayne@68 268
jpayne@68 269 If a string argument passed to the DateTime constructor cannot be
jpayne@68 270 parsed, it will raise SyntaxError. Invalid date, time, or
jpayne@68 271 timezone components will raise a DateTimeError.
jpayne@68 272
jpayne@68 273 The module function Timezones() will return a list of the timezones
jpayne@68 274 recognized by the DateTime module. Recognition of timezone names is
jpayne@68 275 case-insensitive.
jpayne@68 276
jpayne@68 277 Instance Methods for DateTime (IDateTime interface)
jpayne@68 278 ---------------------------------------------------
jpayne@68 279
jpayne@68 280 Conversion and comparison methods
jpayne@68 281 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jpayne@68 282
jpayne@68 283 * ``timeTime()`` returns the date/time as a floating-point number in
jpayne@68 284 UTC, in the format used by the Python time module. Note that it is
jpayne@68 285 possible to create date /time values with DateTime that have no
jpayne@68 286 meaningful value to the time module, and in such cases a
jpayne@68 287 DateTimeError is raised. A DateTime object's value must generally
jpayne@68 288 be between Jan 1, 1970 (or your local machine epoch) and Jan 2038 to
jpayne@68 289 produce a valid time.time() style value.
jpayne@68 290
jpayne@68 291 >>> dt = DateTime('Mar 9, 1997 13:45:00 US/Eastern')
jpayne@68 292 >>> dt.timeTime()
jpayne@68 293 857933100.0
jpayne@68 294
jpayne@68 295 >>> DateTime('2040/01/01 UTC').timeTime()
jpayne@68 296 2208988800.0
jpayne@68 297
jpayne@68 298 >>> DateTime('1900/01/01 UTC').timeTime()
jpayne@68 299 -2208988800.0
jpayne@68 300
jpayne@68 301 * ``toZone(z)`` returns a DateTime with the value as the current
jpayne@68 302 object, represented in the indicated timezone:
jpayne@68 303
jpayne@68 304 >>> dt.toZone('UTC')
jpayne@68 305 DateTime('1997/03/09 18:45:00 UTC')
jpayne@68 306
jpayne@68 307 >>> dt.toZone('UTC').equalTo(dt)
jpayne@68 308 True
jpayne@68 309
jpayne@68 310 * ``isFuture()`` returns true if this object represents a date/time
jpayne@68 311 later than the time of the call:
jpayne@68 312
jpayne@68 313 >>> dt.isFuture()
jpayne@68 314 False
jpayne@68 315 >>> DateTime('Jan 1 3000').isFuture() # not time-machine safe!
jpayne@68 316 True
jpayne@68 317
jpayne@68 318 * ``isPast()`` returns true if this object represents a date/time
jpayne@68 319 earlier than the time of the call:
jpayne@68 320
jpayne@68 321 >>> dt.isPast()
jpayne@68 322 True
jpayne@68 323 >>> DateTime('Jan 1 3000').isPast() # not time-machine safe!
jpayne@68 324 False
jpayne@68 325
jpayne@68 326 * ``isCurrentYear()`` returns true if this object represents a
jpayne@68 327 date/time that falls within the current year, in the context of this
jpayne@68 328 object's timezone representation:
jpayne@68 329
jpayne@68 330 >>> dt.isCurrentYear()
jpayne@68 331 False
jpayne@68 332 >>> DateTime().isCurrentYear()
jpayne@68 333 True
jpayne@68 334
jpayne@68 335 * ``isCurrentMonth()`` returns true if this object represents a
jpayne@68 336 date/time that falls within the current month, in the context of
jpayne@68 337 this object's timezone representation:
jpayne@68 338
jpayne@68 339 >>> dt.isCurrentMonth()
jpayne@68 340 False
jpayne@68 341 >>> DateTime().isCurrentMonth()
jpayne@68 342 True
jpayne@68 343
jpayne@68 344 * ``isCurrentDay()`` returns true if this object represents a
jpayne@68 345 date/time that falls within the current day, in the context of this
jpayne@68 346 object's timezone representation:
jpayne@68 347
jpayne@68 348 >>> dt.isCurrentDay()
jpayne@68 349 False
jpayne@68 350 >>> DateTime().isCurrentDay()
jpayne@68 351 True
jpayne@68 352
jpayne@68 353 * ``isCurrentHour()`` returns true if this object represents a
jpayne@68 354 date/time that falls within the current hour, in the context of this
jpayne@68 355 object's timezone representation:
jpayne@68 356
jpayne@68 357 >>> dt.isCurrentHour()
jpayne@68 358 False
jpayne@68 359
jpayne@68 360 >>> DateTime().isCurrentHour()
jpayne@68 361 True
jpayne@68 362
jpayne@68 363 * ``isCurrentMinute()`` returns true if this object represents a
jpayne@68 364 date/time that falls within the current minute, in the context of
jpayne@68 365 this object's timezone representation:
jpayne@68 366
jpayne@68 367 >>> dt.isCurrentMinute()
jpayne@68 368 False
jpayne@68 369 >>> DateTime().isCurrentMinute()
jpayne@68 370 True
jpayne@68 371
jpayne@68 372 * ``isLeapYear()`` returns true if the current year (in the context of
jpayne@68 373 the object's timezone) is a leap year:
jpayne@68 374
jpayne@68 375 >>> dt.isLeapYear()
jpayne@68 376 False
jpayne@68 377 >>> DateTime('Mar 8 2004').isLeapYear()
jpayne@68 378 True
jpayne@68 379
jpayne@68 380 * ``earliestTime()`` returns a new DateTime object that represents the
jpayne@68 381 earliest possible time (in whole seconds) that still falls within
jpayne@68 382 the current object's day, in the object's timezone context:
jpayne@68 383
jpayne@68 384 >>> dt.earliestTime()
jpayne@68 385 DateTime('1997/03/09 00:00:00 US/Eastern')
jpayne@68 386
jpayne@68 387 * ``latestTime()`` return a new DateTime object that represents the
jpayne@68 388 latest possible time (in whole seconds) that still falls within the
jpayne@68 389 current object's day, in the object's timezone context
jpayne@68 390
jpayne@68 391 >>> dt.latestTime()
jpayne@68 392 DateTime('1997/03/09 23:59:59 US/Eastern')
jpayne@68 393
jpayne@68 394 Component access
jpayne@68 395 ~~~~~~~~~~~~~~~~
jpayne@68 396
jpayne@68 397 * ``parts()`` returns a tuple containing the calendar year, month,
jpayne@68 398 day, hour, minute second and timezone of the object
jpayne@68 399
jpayne@68 400 >>> dt.parts() # doctest: +ELLIPSIS
jpayne@68 401 (1997, 3, 9, 13, 45, ... 'US/Eastern')
jpayne@68 402
jpayne@68 403 * ``timezone()`` returns the timezone in which the object is represented:
jpayne@68 404
jpayne@68 405 >>> dt.timezone() in Timezones()
jpayne@68 406 True
jpayne@68 407
jpayne@68 408 * ``tzoffset()`` returns the timezone offset for the objects timezone:
jpayne@68 409
jpayne@68 410 >>> dt.tzoffset()
jpayne@68 411 -18000
jpayne@68 412
jpayne@68 413 * ``year()`` returns the calendar year of the object:
jpayne@68 414
jpayne@68 415 >>> dt.year()
jpayne@68 416 1997
jpayne@68 417
jpayne@68 418 * ``month()`` returns the month of the object as an integer:
jpayne@68 419
jpayne@68 420 >>> dt.month()
jpayne@68 421 3
jpayne@68 422
jpayne@68 423 * ``Month()`` returns the full month name:
jpayne@68 424
jpayne@68 425 >>> dt.Month()
jpayne@68 426 'March'
jpayne@68 427
jpayne@68 428 * ``aMonth()`` returns the abbreviated month name:
jpayne@68 429
jpayne@68 430 >>> dt.aMonth()
jpayne@68 431 'Mar'
jpayne@68 432
jpayne@68 433 * ``pMonth()`` returns the abbreviated (with period) month name:
jpayne@68 434
jpayne@68 435 >>> dt.pMonth()
jpayne@68 436 'Mar.'
jpayne@68 437
jpayne@68 438 * ``day()`` returns the integer day:
jpayne@68 439
jpayne@68 440 >>> dt.day()
jpayne@68 441 9
jpayne@68 442
jpayne@68 443 * ``Day()`` returns the full name of the day of the week:
jpayne@68 444
jpayne@68 445 >>> dt.Day()
jpayne@68 446 'Sunday'
jpayne@68 447
jpayne@68 448 * ``dayOfYear()`` returns the day of the year, in context of the
jpayne@68 449 timezone representation of the object:
jpayne@68 450
jpayne@68 451 >>> dt.dayOfYear()
jpayne@68 452 68
jpayne@68 453
jpayne@68 454 * ``aDay()`` returns the abbreviated name of the day of the week:
jpayne@68 455
jpayne@68 456 >>> dt.aDay()
jpayne@68 457 'Sun'
jpayne@68 458
jpayne@68 459 * ``pDay()`` returns the abbreviated (with period) name of the day of
jpayne@68 460 the week:
jpayne@68 461
jpayne@68 462 >>> dt.pDay()
jpayne@68 463 'Sun.'
jpayne@68 464
jpayne@68 465 * ``dow()`` returns the integer day of the week, where Sunday is 0:
jpayne@68 466
jpayne@68 467 >>> dt.dow()
jpayne@68 468 0
jpayne@68 469
jpayne@68 470 * ``dow_1()`` returns the integer day of the week, where sunday is 1:
jpayne@68 471
jpayne@68 472 >>> dt.dow_1()
jpayne@68 473 1
jpayne@68 474
jpayne@68 475 * ``h_12()`` returns the 12-hour clock representation of the hour:
jpayne@68 476
jpayne@68 477 >>> dt.h_12()
jpayne@68 478 1
jpayne@68 479
jpayne@68 480 * ``h_24()`` returns the 24-hour clock representation of the hour:
jpayne@68 481
jpayne@68 482 >>> dt.h_24()
jpayne@68 483 13
jpayne@68 484
jpayne@68 485 * ``ampm()`` returns the appropriate time modifier (am or pm):
jpayne@68 486
jpayne@68 487 >>> dt.ampm()
jpayne@68 488 'pm'
jpayne@68 489
jpayne@68 490 * ``hour()`` returns the 24-hour clock representation of the hour:
jpayne@68 491
jpayne@68 492 >>> dt.hour()
jpayne@68 493 13
jpayne@68 494
jpayne@68 495 * ``minute()`` returns the minute:
jpayne@68 496
jpayne@68 497 >>> dt.minute()
jpayne@68 498 45
jpayne@68 499
jpayne@68 500 * ``second()`` returns the second:
jpayne@68 501
jpayne@68 502 >>> dt.second() == 0
jpayne@68 503 True
jpayne@68 504
jpayne@68 505 * ``millis()`` returns the milliseconds since the epoch in GMT.
jpayne@68 506
jpayne@68 507 >>> dt.millis() == 857933100000
jpayne@68 508 True
jpayne@68 509
jpayne@68 510 strftime()
jpayne@68 511 ~~~~~~~~~~
jpayne@68 512
jpayne@68 513 See ``tests/test_datetime.py``.
jpayne@68 514
jpayne@68 515 General formats from previous DateTime
jpayne@68 516 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jpayne@68 517
jpayne@68 518 * ``Date()`` return the date string for the object:
jpayne@68 519
jpayne@68 520 >>> dt.Date()
jpayne@68 521 '1997/03/09'
jpayne@68 522
jpayne@68 523 * ``Time()`` returns the time string for an object to the nearest
jpayne@68 524 second:
jpayne@68 525
jpayne@68 526 >>> dt.Time()
jpayne@68 527 '13:45:00'
jpayne@68 528
jpayne@68 529 * ``TimeMinutes()`` returns the time string for an object not showing
jpayne@68 530 seconds:
jpayne@68 531
jpayne@68 532 >>> dt.TimeMinutes()
jpayne@68 533 '13:45'
jpayne@68 534
jpayne@68 535 * ``AMPM()`` returns the time string for an object to the nearest second:
jpayne@68 536
jpayne@68 537 >>> dt.AMPM()
jpayne@68 538 '01:45:00 pm'
jpayne@68 539
jpayne@68 540 * ``AMPMMinutes()`` returns the time string for an object not showing
jpayne@68 541 seconds:
jpayne@68 542
jpayne@68 543 >>> dt.AMPMMinutes()
jpayne@68 544 '01:45 pm'
jpayne@68 545
jpayne@68 546 * ``PreciseTime()`` returns the time string for the object:
jpayne@68 547
jpayne@68 548 >>> dt.PreciseTime()
jpayne@68 549 '13:45:00.000'
jpayne@68 550
jpayne@68 551 * ``PreciseAMPM()`` returns the time string for the object:
jpayne@68 552
jpayne@68 553 >>> dt.PreciseAMPM()
jpayne@68 554 '01:45:00.000 pm'
jpayne@68 555
jpayne@68 556 * ``yy()`` returns the calendar year as a 2 digit string
jpayne@68 557
jpayne@68 558 >>> dt.yy()
jpayne@68 559 '97'
jpayne@68 560
jpayne@68 561 * ``mm()`` returns the month as a 2 digit string
jpayne@68 562
jpayne@68 563 >>> dt.mm()
jpayne@68 564 '03'
jpayne@68 565
jpayne@68 566 * ``dd()`` returns the day as a 2 digit string:
jpayne@68 567
jpayne@68 568 >>> dt.dd()
jpayne@68 569 '09'
jpayne@68 570
jpayne@68 571 * ``rfc822()`` returns the date in RFC 822 format:
jpayne@68 572
jpayne@68 573 >>> dt.rfc822()
jpayne@68 574 'Sun, 09 Mar 1997 13:45:00 -0500'
jpayne@68 575
jpayne@68 576 New formats
jpayne@68 577 ~~~~~~~~~~~
jpayne@68 578
jpayne@68 579 * ``fCommon()`` returns a string representing the object's value in
jpayne@68 580 the format: March 9, 1997 1:45 pm:
jpayne@68 581
jpayne@68 582 >>> dt.fCommon()
jpayne@68 583 'March 9, 1997 1:45 pm'
jpayne@68 584
jpayne@68 585 * ``fCommonZ()`` returns a string representing the object's value in
jpayne@68 586 the format: March 9, 1997 1:45 pm US/Eastern:
jpayne@68 587
jpayne@68 588 >>> dt.fCommonZ()
jpayne@68 589 'March 9, 1997 1:45 pm US/Eastern'
jpayne@68 590
jpayne@68 591 * ``aCommon()`` returns a string representing the object's value in
jpayne@68 592 the format: Mar 9, 1997 1:45 pm:
jpayne@68 593
jpayne@68 594 >>> dt.aCommon()
jpayne@68 595 'Mar 9, 1997 1:45 pm'
jpayne@68 596
jpayne@68 597 * ``aCommonZ()`` return a string representing the object's value in
jpayne@68 598 the format: Mar 9, 1997 1:45 pm US/Eastern:
jpayne@68 599
jpayne@68 600 >>> dt.aCommonZ()
jpayne@68 601 'Mar 9, 1997 1:45 pm US/Eastern'
jpayne@68 602
jpayne@68 603 * ``pCommon()`` returns a string representing the object's value in
jpayne@68 604 the format Mar. 9, 1997 1:45 pm:
jpayne@68 605
jpayne@68 606 >>> dt.pCommon()
jpayne@68 607 'Mar. 9, 1997 1:45 pm'
jpayne@68 608
jpayne@68 609 * ``pCommonZ()`` returns a string representing the object's value in
jpayne@68 610 the format: Mar. 9, 1997 1:45 pm US/Eastern:
jpayne@68 611
jpayne@68 612 >>> dt.pCommonZ()
jpayne@68 613 'Mar. 9, 1997 1:45 pm US/Eastern'
jpayne@68 614
jpayne@68 615 * ``ISO()`` returns a string with the date/time in ISO format. Note:
jpayne@68 616 this is not ISO 8601-format! See the ISO8601 and HTML4 methods below
jpayne@68 617 for ISO 8601-compliant output. Dates are output as: YYYY-MM-DD HH:MM:SS
jpayne@68 618
jpayne@68 619 >>> dt.ISO()
jpayne@68 620 '1997-03-09 13:45:00'
jpayne@68 621
jpayne@68 622 * ``ISO8601()`` returns the object in ISO 8601-compatible format
jpayne@68 623 containing the date, time with seconds-precision and the time zone
jpayne@68 624 identifier - see http://www.w3.org/TR/NOTE-datetime. Dates are
jpayne@68 625 output as: YYYY-MM-DDTHH:MM:SSTZD (T is a literal character, TZD is
jpayne@68 626 Time Zone Designator, format +HH:MM or -HH:MM).
jpayne@68 627
jpayne@68 628 The ``HTML4()`` method below offers the same formatting, but
jpayne@68 629 converts to UTC before returning the value and sets the TZD"Z"
jpayne@68 630
jpayne@68 631 >>> dt.ISO8601()
jpayne@68 632 '1997-03-09T13:45:00-05:00'
jpayne@68 633
jpayne@68 634
jpayne@68 635 * ``HTML4()`` returns the object in the format used in the HTML4.0
jpayne@68 636 specification, one of the standard forms in ISO8601. See
jpayne@68 637 http://www.w3.org/TR/NOTE-datetime. Dates are output as:
jpayne@68 638 YYYY-MM-DDTHH:MM:SSZ (T, Z are literal characters, the time is in
jpayne@68 639 UTC.):
jpayne@68 640
jpayne@68 641 >>> dt.HTML4()
jpayne@68 642 '1997-03-09T18:45:00Z'
jpayne@68 643
jpayne@68 644 * ``JulianDay()`` returns the Julian day according to
jpayne@68 645 http://www.tondering.dk/claus/cal/node3.html#sec-calcjd
jpayne@68 646
jpayne@68 647 >>> dt.JulianDay()
jpayne@68 648 2450517
jpayne@68 649
jpayne@68 650 * ``week()`` returns the week number according to ISO
jpayne@68 651 see http://www.tondering.dk/claus/cal/node6.html#SECTION00670000000000000000
jpayne@68 652
jpayne@68 653 >>> dt.week()
jpayne@68 654 10
jpayne@68 655
jpayne@68 656 Deprecated API
jpayne@68 657 ~~~~~~~~~~~~~~
jpayne@68 658
jpayne@68 659 * DayOfWeek(): see Day()
jpayne@68 660
jpayne@68 661 * Day_(): see pDay()
jpayne@68 662
jpayne@68 663 * Mon(): see aMonth()
jpayne@68 664
jpayne@68 665 * Mon_(): see pMonth
jpayne@68 666
jpayne@68 667 General Services Provided by DateTime
jpayne@68 668 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jpayne@68 669
jpayne@68 670 DateTimes can be repr()'ed; the result will be a string indicating how
jpayne@68 671 to make a DateTime object like this:
jpayne@68 672
jpayne@68 673 >>> repr(dt)
jpayne@68 674 "DateTime('1997/03/09 13:45:00 US/Eastern')"
jpayne@68 675
jpayne@68 676 When we convert them into a string, we get a nicer string that could
jpayne@68 677 actually be shown to a user:
jpayne@68 678
jpayne@68 679 >>> str(dt)
jpayne@68 680 '1997/03/09 13:45:00 US/Eastern'
jpayne@68 681
jpayne@68 682 The hash value of a DateTime is based on the date and time and is
jpayne@68 683 equal for different representations of the DateTime:
jpayne@68 684
jpayne@68 685 >>> hash(dt)
jpayne@68 686 3618678
jpayne@68 687 >>> hash(dt.toZone('UTC'))
jpayne@68 688 3618678
jpayne@68 689
jpayne@68 690 DateTime objects can be compared to other DateTime objects OR floating
jpayne@68 691 point numbers such as the ones which are returned by the Python time
jpayne@68 692 module by using the equalTo method. Using this API, True is returned if the
jpayne@68 693 object represents a date/time equal to the specified DateTime or time module
jpayne@68 694 style time:
jpayne@68 695
jpayne@68 696 >>> dt.equalTo(dt)
jpayne@68 697 True
jpayne@68 698 >>> dt.equalTo(dt.toZone('UTC'))
jpayne@68 699 True
jpayne@68 700 >>> dt.equalTo(dt.timeTime())
jpayne@68 701 True
jpayne@68 702 >>> dt.equalTo(DateTime())
jpayne@68 703 False
jpayne@68 704
jpayne@68 705 Same goes for inequalities:
jpayne@68 706
jpayne@68 707 >>> dt.notEqualTo(dt)
jpayne@68 708 False
jpayne@68 709 >>> dt.notEqualTo(dt.toZone('UTC'))
jpayne@68 710 False
jpayne@68 711 >>> dt.notEqualTo(dt.timeTime())
jpayne@68 712 False
jpayne@68 713 >>> dt.notEqualTo(DateTime())
jpayne@68 714 True
jpayne@68 715
jpayne@68 716 Normal equality operations only work with DateTime objects and take the
jpayne@68 717 timezone setting into account:
jpayne@68 718
jpayne@68 719 >>> dt == dt
jpayne@68 720 True
jpayne@68 721 >>> dt == dt.toZone('UTC')
jpayne@68 722 False
jpayne@68 723 >>> dt == DateTime()
jpayne@68 724 False
jpayne@68 725
jpayne@68 726 >>> dt != dt
jpayne@68 727 False
jpayne@68 728 >>> dt != dt.toZone('UTC')
jpayne@68 729 True
jpayne@68 730 >>> dt != DateTime()
jpayne@68 731 True
jpayne@68 732
jpayne@68 733 But the other comparison operations compare the referenced moment in time and
jpayne@68 734 not the representation itself:
jpayne@68 735
jpayne@68 736 >>> dt > dt
jpayne@68 737 False
jpayne@68 738 >>> DateTime() > dt
jpayne@68 739 True
jpayne@68 740 >>> dt > DateTime().timeTime()
jpayne@68 741 False
jpayne@68 742 >>> DateTime().timeTime() > dt
jpayne@68 743 True
jpayne@68 744
jpayne@68 745 >>> dt.greaterThan(dt)
jpayne@68 746 False
jpayne@68 747 >>> DateTime().greaterThan(dt)
jpayne@68 748 True
jpayne@68 749 >>> dt.greaterThan(DateTime().timeTime())
jpayne@68 750 False
jpayne@68 751
jpayne@68 752 >>> dt >= dt
jpayne@68 753 True
jpayne@68 754 >>> DateTime() >= dt
jpayne@68 755 True
jpayne@68 756 >>> dt >= DateTime().timeTime()
jpayne@68 757 False
jpayne@68 758 >>> DateTime().timeTime() >= dt
jpayne@68 759 True
jpayne@68 760
jpayne@68 761 >>> dt.greaterThanEqualTo(dt)
jpayne@68 762 True
jpayne@68 763 >>> DateTime().greaterThanEqualTo(dt)
jpayne@68 764 True
jpayne@68 765 >>> dt.greaterThanEqualTo(DateTime().timeTime())
jpayne@68 766 False
jpayne@68 767
jpayne@68 768 >>> dt < dt
jpayne@68 769 False
jpayne@68 770 >>> DateTime() < dt
jpayne@68 771 False
jpayne@68 772 >>> dt < DateTime().timeTime()
jpayne@68 773 True
jpayne@68 774 >>> DateTime().timeTime() < dt
jpayne@68 775 False
jpayne@68 776
jpayne@68 777 >>> dt.lessThan(dt)
jpayne@68 778 False
jpayne@68 779 >>> DateTime().lessThan(dt)
jpayne@68 780 False
jpayne@68 781 >>> dt.lessThan(DateTime().timeTime())
jpayne@68 782 True
jpayne@68 783
jpayne@68 784 >>> dt <= dt
jpayne@68 785 True
jpayne@68 786 >>> DateTime() <= dt
jpayne@68 787 False
jpayne@68 788 >>> dt <= DateTime().timeTime()
jpayne@68 789 True
jpayne@68 790 >>> DateTime().timeTime() <= dt
jpayne@68 791 False
jpayne@68 792
jpayne@68 793 >>> dt.lessThanEqualTo(dt)
jpayne@68 794 True
jpayne@68 795 >>> DateTime().lessThanEqualTo(dt)
jpayne@68 796 False
jpayne@68 797 >>> dt.lessThanEqualTo(DateTime().timeTime())
jpayne@68 798 True
jpayne@68 799
jpayne@68 800 Numeric Services Provided by DateTime
jpayne@68 801 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jpayne@68 802
jpayne@68 803 A DateTime may be added to a number and a number may be added to a
jpayne@68 804 DateTime:
jpayne@68 805
jpayne@68 806 >>> dt + 5
jpayne@68 807 DateTime('1997/03/14 13:45:00 US/Eastern')
jpayne@68 808 >>> 5 + dt
jpayne@68 809 DateTime('1997/03/14 13:45:00 US/Eastern')
jpayne@68 810
jpayne@68 811 Two DateTimes cannot be added:
jpayne@68 812
jpayne@68 813 >>> from DateTime.interfaces import DateTimeError
jpayne@68 814 >>> try:
jpayne@68 815 ... dt + dt
jpayne@68 816 ... print('fail')
jpayne@68 817 ... except DateTimeError:
jpayne@68 818 ... print('ok')
jpayne@68 819 ok
jpayne@68 820
jpayne@68 821 Either a DateTime or a number may be subtracted from a DateTime,
jpayne@68 822 however, a DateTime may not be subtracted from a number:
jpayne@68 823
jpayne@68 824 >>> DateTime('1997/03/10 13:45 US/Eastern') - dt
jpayne@68 825 1.0
jpayne@68 826 >>> dt - 1
jpayne@68 827 DateTime('1997/03/08 13:45:00 US/Eastern')
jpayne@68 828 >>> 1 - dt
jpayne@68 829 Traceback (most recent call last):
jpayne@68 830 ...
jpayne@68 831 TypeError: unsupported operand type(s) for -: 'int' and 'DateTime'
jpayne@68 832
jpayne@68 833 DateTimes can also be converted to integers (number of seconds since
jpayne@68 834 the epoch) and floats:
jpayne@68 835
jpayne@68 836 >>> int(dt)
jpayne@68 837 857933100
jpayne@68 838 >>> float(dt)
jpayne@68 839 857933100.0
jpayne@68 840
jpayne@68 841
jpayne@68 842 Changelog
jpayne@68 843 =========
jpayne@68 844
jpayne@68 845 5.5 (2024-03-21)
jpayne@68 846 ----------------
jpayne@68 847
jpayne@68 848 - Change pickle format to export the microseconds as an int, to
jpayne@68 849 solve a problem with dates after 2038.
jpayne@68 850 (`#56 <https://github.com/zopefoundation/DateTime/issues/56>`_)
jpayne@68 851
jpayne@68 852
jpayne@68 853 5.4 (2023-12-15)
jpayne@68 854 ----------------
jpayne@68 855
jpayne@68 856 - Fix ``UnknownTimeZoneError`` when unpickling ``DateTime.DateTime().asdatetime()``.
jpayne@68 857 (`#58 <https://github.com/zopefoundation/DateTime/issues/58>`_)
jpayne@68 858
jpayne@68 859 - Repair equality comparison between DateTime instances and other types.
jpayne@68 860 (`#60 <https://github.com/zopefoundation/DateTime/issues/60>`_)
jpayne@68 861
jpayne@68 862
jpayne@68 863 5.3 (2023-11-14)
jpayne@68 864 ----------------
jpayne@68 865
jpayne@68 866 - Add support for Python 3.12.
jpayne@68 867
jpayne@68 868 - Add preliminary support for Python 3.13a2.
jpayne@68 869
jpayne@68 870
jpayne@68 871 5.2 (2023-07-19)
jpayne@68 872 ----------------
jpayne@68 873
jpayne@68 874 - Cast int to float in compare methods.
jpayne@68 875 - Fix compare methods between DateTime instances and None.
jpayne@68 876 (`#52 <https://github.com/zopefoundation/DateTime/issues/52>`_)
jpayne@68 877
jpayne@68 878
jpayne@68 879 5.1 (2023-03-14)
jpayne@68 880 ----------------
jpayne@68 881
jpayne@68 882 - Add missing ``python_requires`` to ``setup.py``.
jpayne@68 883
jpayne@68 884
jpayne@68 885 5.0 (2023-01-12)
jpayne@68 886 ----------------
jpayne@68 887
jpayne@68 888 - Drop support for Python 2.7, 3.5, 3.6.
jpayne@68 889
jpayne@68 890
jpayne@68 891 4.8 (2022-12-16)
jpayne@68 892 ----------------
jpayne@68 893
jpayne@68 894 - Fix insidious buildout configuration bug that prevented tests on Python 2.7
jpayne@68 895 and 3.5, and fix test code that was incompatible with Python 3.5.
jpayne@68 896 (`#44 <https://github.com/zopefoundation/DateTime/issues/44>`_)
jpayne@68 897
jpayne@68 898 - Add support for Python 3.11.
jpayne@68 899
jpayne@68 900
jpayne@68 901 4.7 (2022-09-14)
jpayne@68 902 ----------------
jpayne@68 903
jpayne@68 904 - Fix rounding problem with `DateTime` addition beyond the year 2038
jpayne@68 905 (`#41 <https://github.com/zopefoundation/DateTime/issues/41>`_)
jpayne@68 906
jpayne@68 907
jpayne@68 908 4.6 (2022-09-10)
jpayne@68 909 ----------------
jpayne@68 910
jpayne@68 911 - Fix ``__format__`` method for DateTime objects
jpayne@68 912 (`#39 <https://github.com/zopefoundation/DateTime/issues/39>`_)
jpayne@68 913
jpayne@68 914
jpayne@68 915 4.5 (2022-07-04)
jpayne@68 916 ----------------
jpayne@68 917
jpayne@68 918 - Add ``__format__`` method for DateTime objects
jpayne@68 919 (`#35 <https://github.com/zopefoundation/DateTime/issues/35>`_)
jpayne@68 920
jpayne@68 921
jpayne@68 922 4.4 (2022-02-11)
jpayne@68 923 ----------------
jpayne@68 924
jpayne@68 925 - Fix WAT definition
jpayne@68 926 `#31 <https://github.com/zopefoundation/DateTime/issues/31>`_.
jpayne@68 927
jpayne@68 928 - Add support for Python 3.8, 3.9, and 3.10.
jpayne@68 929
jpayne@68 930 - Drop support for Python 3.4.
jpayne@68 931
jpayne@68 932 4.3 (2018-10-05)
jpayne@68 933 ----------------
jpayne@68 934
jpayne@68 935 - Add support for Python 3.7.
jpayne@68 936
jpayne@68 937 4.2 (2017-04-26)
jpayne@68 938 ----------------
jpayne@68 939
jpayne@68 940 - Add support for Python 3.6, drop support for Python 3.3.
jpayne@68 941
jpayne@68 942 4.1.1 (2016-04-30)
jpayne@68 943 ------------------
jpayne@68 944
jpayne@68 945 - Support unpickling instances having a numeric timezone like `+0430`.
jpayne@68 946
jpayne@68 947 4.1 (2016-04-03)
jpayne@68 948 ----------------
jpayne@68 949
jpayne@68 950 - Add support for Python 3.4 and 3.5.
jpayne@68 951
jpayne@68 952 - Drop support for Python 2.6 and 3.2.
jpayne@68 953
jpayne@68 954 4.0.1 (2013-10-15)
jpayne@68 955 ------------------
jpayne@68 956
jpayne@68 957 - Provide more backward compatible timezones.
jpayne@68 958 [vangheem]
jpayne@68 959
jpayne@68 960 4.0 (2013-02-23)
jpayne@68 961 ----------------
jpayne@68 962
jpayne@68 963 - Added support for Python 3.2 and 3.3 in addition to 2.6 and 2.7.
jpayne@68 964
jpayne@68 965 - Removed unused legacy pytz tests and the DateTimeZone module and renamed
jpayne@68 966 some test internals.
jpayne@68 967
jpayne@68 968 3.0.3 (2013-01-22)
jpayne@68 969 ------------------
jpayne@68 970
jpayne@68 971 - Allow timezone argument to be a Unicode string while creating a DateTime
jpayne@68 972 object using two arguments.
jpayne@68 973
jpayne@68 974 3.0.2 (2012-10-21)
jpayne@68 975 ------------------
jpayne@68 976
jpayne@68 977 - LP #1045233: Respect date format setting for parsing dates like `11-01-2001`.
jpayne@68 978
jpayne@68 979 3.0.1 (2012-09-23)
jpayne@68 980 ------------------
jpayne@68 981
jpayne@68 982 - Add `_dt_reconstructor` function introduced in DateTime 2.12.7 to provide
jpayne@68 983 forward compatibility with pickles that might reference this function.
jpayne@68 984
jpayne@68 985 3.0 (2011-12-09)
jpayne@68 986 ----------------
jpayne@68 987
jpayne@68 988 - No changes.
jpayne@68 989
jpayne@68 990 Backwards compatibility of DateTime 3
jpayne@68 991 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jpayne@68 992
jpayne@68 993 DateTime 3 changes its pickle representation. DateTime instances pickled with
jpayne@68 994 former versions of DateTime can be read, but older DateTime versions cannot read
jpayne@68 995 DateTime instances pickled with version 3.
jpayne@68 996
jpayne@68 997 DateTime 3 changes DateTime to be a new-style class with slots instead of being
jpayne@68 998 an old-style class.
jpayne@68 999
jpayne@68 1000 DateTime 3 tries to preserve microsecond resolution throughout most of its API's
jpayne@68 1001 while former versions were often only accurate to millisecond resolution. Due to
jpayne@68 1002 the representation of float values in Python versions before Python 2.7 you
jpayne@68 1003 shouldn't compare string or float representations of DateTime instances if you
jpayne@68 1004 want high accuracy. The same is true for calculated values returned by methods
jpayne@68 1005 like `timeTime()`. You get the highest accuracy of comparing DateTime values by
jpayne@68 1006 calling its `micros()` methods. DateTime is not particular well suited to be
jpayne@68 1007 used in comparing timestamps of file systems - use the time and datetime objects
jpayne@68 1008 from the Python standard library instead.
jpayne@68 1009
jpayne@68 1010 3.0b3 (2011-10-19)
jpayne@68 1011 ------------------
jpayne@68 1012
jpayne@68 1013 - Allow comparison of DateTime objects against None.
jpayne@68 1014
jpayne@68 1015 3.0b2 (2011-10-19)
jpayne@68 1016 ------------------
jpayne@68 1017
jpayne@68 1018 - Reverted the single argument `None` special case handling for unpickling and
jpayne@68 1019 continue to treat it as meaning `now`.
jpayne@68 1020
jpayne@68 1021 3.0b1 (2011-05-07)
jpayne@68 1022 ------------------
jpayne@68 1023
jpayne@68 1024 - Restored `strftimeFormatter` as a class.
jpayne@68 1025
jpayne@68 1026 - Added tests for read-only class attributes and interface.
jpayne@68 1027
jpayne@68 1028 3.0a2 (2011-05-07)
jpayne@68 1029 ------------------
jpayne@68 1030
jpayne@68 1031 - Added back support for reading old DateTime pickles without a `_micros` value.
jpayne@68 1032
jpayne@68 1033 - Avoid storing `_t` representing the time as a float in seconds since the
jpayne@68 1034 epoch, as we already have `_micros` doing the same as a long. Memory use is
jpayne@68 1035 down to about 300 bytes per DateTime instance.
jpayne@68 1036
jpayne@68 1037 - Updated exception raising syntax to current style.
jpayne@68 1038
jpayne@68 1039 - Avoid storing `_aday`, `_fday`, `_pday`, `_amon`, `_fmon`, `_pmon`, `_pmhour`
jpayne@68 1040 and `_pm` in memory for every instance but look them up dynamically based on
jpayne@68 1041 `_dayoffset`, `_month` and `_hour`. This saves another 150 bytes of memory
jpayne@68 1042 per DateTime instance.
jpayne@68 1043
jpayne@68 1044 - Moved various internal parsing related class variables to module constants.
jpayne@68 1045
jpayne@68 1046 - No longer provide the `DateError`, `DateTimeError`, `SyntaxError` and
jpayne@68 1047 `TimeError` exceptions as class attributes, import them from their canonical
jpayne@68 1048 `DateTime.interfaces` location instead.
jpayne@68 1049
jpayne@68 1050 - Removed deprecated `_isDST` and `_localzone` class variables.
jpayne@68 1051
jpayne@68 1052 - Moved pytz cache from `DateTime._tzinfo` to a module global `_TZINFO`.
jpayne@68 1053
jpayne@68 1054 - Make DateTime a new-style class and limit its available attributes via a
jpayne@68 1055 slots definition. The pickle size increases to 110 bytes thanks to the
jpayne@68 1056 `ccopy_reg\n_reconstructor` stanza. But the memory size drops from 3kb to
jpayne@68 1057 500 bytes for each instance.
jpayne@68 1058
jpayne@68 1059 3.0a1 (2011-05-06)
jpayne@68 1060 ------------------
jpayne@68 1061
jpayne@68 1062 - Reordered some calculations in `_calcIndependentSecondEtc` to preserve more
jpayne@68 1063 floating point precision.
jpayne@68 1064
jpayne@68 1065 - Optimized the pickled data, by only storing a tuple of `_micros` and time
jpayne@68 1066 zone information - this reduces the pickle size from an average of 300 bytes
jpayne@68 1067 to just 60 bytes.
jpayne@68 1068
jpayne@68 1069 - Optimized un-pickling, by avoiding the creation of an intermediate DateTime
jpayne@68 1070 value representing the current time.
jpayne@68 1071
jpayne@68 1072 - Removed in-place migration of old DateTime pickles without a `_micros` value.
jpayne@68 1073
jpayne@68 1074 - Removed deprecated support for using `DateTime.__cmp__`.
jpayne@68 1075
jpayne@68 1076 - Take time zone settings into account when comparing two date times for
jpayne@68 1077 (non-) equality.
jpayne@68 1078
jpayne@68 1079 - Fixed (possibly unused) _parse_iso8601 function.
jpayne@68 1080
jpayne@68 1081 - Removed unused import of legacy DateTimeZone, strftime and re.
jpayne@68 1082 Remove trailing whitespace.
jpayne@68 1083
jpayne@68 1084 - Removed reference to missing version section from buildout.
jpayne@68 1085
jpayne@68 1086 2.12.7 (2012-08-11)
jpayne@68 1087 -------------------
jpayne@68 1088
jpayne@68 1089 - Added forward compatibility with DateTime 3 pickle format. DateTime
jpayne@68 1090 instances constructed under version 3 can be read and unpickled by this
jpayne@68 1091 version. The pickled data is converted to the current versions format
jpayne@68 1092 (old-style class / no slots). Once converted it will be stored again in the
jpayne@68 1093 old format. This should allow for a transparent upgrade/downgrade path
jpayne@68 1094 between DateTime 2 and 3.
jpayne@68 1095
jpayne@68 1096 2.12.6 (2010-10-17)
jpayne@68 1097 -------------------
jpayne@68 1098
jpayne@68 1099 - Changed ``testDayOfWeek`` test to be independent of OS locale.
jpayne@68 1100
jpayne@68 1101 2.12.5 (2010-07-29)
jpayne@68 1102 -------------------
jpayne@68 1103
jpayne@68 1104 - Launchpad #143269: Corrected the documentation for year value
jpayne@68 1105 behavior when constructing a DateTime object with three numeric
jpayne@68 1106 arguments.
jpayne@68 1107
jpayne@68 1108 - Launchpad #142521: Removed confusing special case in
jpayne@68 1109 DateTime.__str__ where DateTime instances for midnight
jpayne@68 1110 (e.g. '2010-07-27 00:00:00 US/Eastern') values would
jpayne@68 1111 render only their date and nothing else.
jpayne@68 1112
jpayne@68 1113 2.12.4 (2010-07-12)
jpayne@68 1114 -------------------
jpayne@68 1115
jpayne@68 1116 - Fixed mapping of EDT (was -> 'GMT-0400', now 'GMT-4').
jpayne@68 1117
jpayne@68 1118 2.12.3 (2010-07-09)
jpayne@68 1119 -------------------
jpayne@68 1120
jpayne@68 1121 - Added EDT timezone support. Addresses bug #599856.
jpayne@68 1122 [vangheem]
jpayne@68 1123
jpayne@68 1124 2.12.2 (2010-05-05)
jpayne@68 1125 -------------------
jpayne@68 1126
jpayne@68 1127 - Launchpad #572715: Relaxed pin on pytz, after applying a patch from
jpayne@68 1128 Marius Gedminus which fixes the apparent API breakage.
jpayne@68 1129
jpayne@68 1130 2.12.1 (2010-04-30)
jpayne@68 1131 -------------------
jpayne@68 1132
jpayne@68 1133 - Removed an undeclared testing dependency on zope.testing.doctest in favor of
jpayne@68 1134 the standard libraries doctest module.
jpayne@68 1135
jpayne@68 1136 - Added a maximum version requirement on pytz <= 2010b. Later versions produce
jpayne@68 1137 test failures related to timezone changes.
jpayne@68 1138
jpayne@68 1139 2.12.0 (2009-03-04)
jpayne@68 1140 -------------------
jpayne@68 1141
jpayne@68 1142 - Launchpad #290254: Forward-ported fix for '_micros'-less pickles from
jpayne@68 1143 the Zope 2.11 branch version.
jpayne@68 1144
jpayne@68 1145 2.11.2 (2009-02-02)
jpayne@68 1146 -------------------
jpayne@68 1147
jpayne@68 1148 - Include *all* pytz zone names, not just "common" ones.
jpayne@68 1149
jpayne@68 1150 - Fix one fragile doctest, band-aid another.
jpayne@68 1151
jpayne@68 1152 - Fix for launchpad #267545: DateTime(DateTime()) should preserve the
jpayne@68 1153 correct hour.
jpayne@68 1154
jpayne@68 1155 2.11.1 (2008-08-05)
jpayne@68 1156 -------------------
jpayne@68 1157
jpayne@68 1158 - DateTime conversion of datetime objects with non-pytz tzinfo. Timezones()
jpayne@68 1159 returns a copy of the timezone list (allows tests to run).
jpayne@68 1160
jpayne@68 1161 - Merged the slinkp-datetime-200007 branch: fix the DateTime(anotherDateTime)
jpayne@68 1162 constructor to preserve timezones.
jpayne@68 1163
jpayne@68 1164 2.11.0b1 (2008-01-06)
jpayne@68 1165 ---------------------
jpayne@68 1166
jpayne@68 1167 - Split off from the Zope2 main source code tree.