Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
fc3032e7
Commit
fc3032e7
authored
Jul 30, 2004
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#1416: Allow construction of a DateTime instance from a given
DateTime instance
parent
ff5b71c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/DateTime/DateTime.py
lib/python/DateTime/DateTime.py
+15
-1
No files found.
doc/CHANGES.txt
View file @
fc3032e7
...
...
@@ -26,6 +26,9 @@ Zope Changes
Features added
- DateTime: new DateTime instance can be constructed from a given
DateTime instance: d_new = DateTime(d_old)
- ZCatalog: added a new configuration option in the "Advanced" tab
to provide optional logging of the progress of long running
reindexing or recataloging operations.
...
...
lib/python/DateTime/DateTime.py
View file @
fc3032e7
...
...
@@ -593,6 +593,10 @@ class DateTime:
the gmt value of the time.time() float represented in
the local machine's timezone.
- If the DateTime function is invoked with a single
argument that is a DateTime instane, a copy of the
passed object will be created.
- If the function is invoked with two numeric arguments,
then the first is taken to be an integer year and the
second argument is taken to be an offset in days from
...
...
@@ -688,7 +692,17 @@ class DateTime:
if
arg
==
''
:
raise
SyntaxError
,
arg
if
isinstance
(
arg
,
(
unicode
,
str
))
and
arg
.
lower
()
in
self
.
_tzinfo
.
_zidx
:
if
isinstance
(
arg
,
DateTime
):
""" Construct a new DateTime instance from a given DateTime instance """
t
=
arg
.
timeTime
()
lt
=
safelocaltime
(
t
)
tz
=
self
.
localZone
(
lt
)
ms
=
(
t
-
math
.
floor
(
t
))
s
,
d
=
_calcSD
(
t
)
yr
,
mo
,
dy
,
hr
,
mn
,
sc
=
lt
[:
6
]
sc
=
sc
+
ms
elif
isinstance
(
arg
,
(
unicode
,
str
))
and
arg
.
lower
()
in
self
.
_tzinfo
.
_zidx
:
# Current time, to be displayed in specified timezone
t
,
tz
=
time
(),
self
.
_tzinfo
.
_zmap
[
arg
.
lower
()]
ms
=
(
t
-
math
.
floor
(
t
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment