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
44fc445d
Commit
44fc445d
authored
Mar 07, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added JulianDay() and week()
parent
3f6e2ae4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
lib/python/DateTime/DateTime.py
lib/python/DateTime/DateTime.py
+21
-1
No files found.
lib/python/DateTime/DateTime.py
View file @
44fc445d
...
...
@@ -12,7 +12,7 @@
##############################################################################
"""Encapsulation of date/time values"""
__version__
=
'$Revision: 1.7
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
7
$'
[
11
:
-
2
]
import
re
,
sys
,
os
,
math
,
DateTimeZone
...
...
@@ -1637,6 +1637,26 @@ class DateTime:
return
year
,
month
,
day
,
hour
,
minute
,
seconds
,
'GMT%+03d%02d'
%
(
hour_off
,
min_off
)
def
JulianDay
(
self
):
"""
Return the Julian day according to
http://www.tondering.dk/claus/cal/node3.html#sec-calcjd
"""
a
=
(
14
-
self
.
_month
)
/
12
#integer division, discard remainder
y
=
self
.
_year
+
4800
-
a
m
=
self
.
_month
+
(
12
*
a
)
-
3
return
self
.
_day
+
(
153
*
m
+
2
)
/
5
+
365
*
y
+
y
/
4
-
y
/
100
+
y
/
400
-
32045
def
week
(
self
):
"""
Return the week number according to ISO
see http://www.tondering.dk/claus/cal/node6.html#SECTION00670000000000000000
"""
J
=
self
.
JulianDay
()
d4
=
(
J
+
31741
-
(
J
%
7
))
%
146097
%
36524
%
1461
L
=
d4
/
1460
d1
=
((
d4
-
L
)
%
365
)
+
L
return
d1
/
7
+
1
class
strftimeFormatter
:
...
...
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