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
94fbe2a1
Commit
94fbe2a1
authored
Jan 07, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip added strftime method and machinery that allows DTML tags
like: <!--#var aDateTime fmt="%Y-%m-%d"-->
parent
3a5d229b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
lib/python/DateTime/DateTime.py
lib/python/DateTime/DateTime.py
+15
-2
No files found.
lib/python/DateTime/DateTime.py
View file @
94fbe2a1
...
@@ -84,12 +84,12 @@
...
@@ -84,12 +84,12 @@
##############################################################################
##############################################################################
"""Encapsulation of date/time values"""
"""Encapsulation of date/time values"""
__version__
=
'$Revision: 1.2
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
1
$'
[
11
:
-
2
]
import
sys
,
os
,
regex
,
DateTimeZone
import
sys
,
os
,
regex
,
DateTimeZone
from
string
import
strip
,
split
,
upper
,
lower
,
atoi
,
atof
,
find
,
join
from
string
import
strip
,
split
,
upper
,
lower
,
atoi
,
atof
,
find
,
join
from
time
import
time
,
gmtime
,
localtime
,
asctime
,
tzname
from
time
import
time
,
gmtime
,
localtime
,
asctime
,
tzname
,
strftime
,
mktime
from
types
import
InstanceType
,
IntType
,
FloatType
,
StringType
from
types
import
InstanceType
,
IntType
,
FloatType
,
StringType
...
@@ -858,6 +858,9 @@ class DateTime:
...
@@ -858,6 +858,9 @@ class DateTime:
def _validTime(self,h,m,s):
def _validTime(self,h,m,s):
return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59
return h>=0 and h<=23 and m>=0 and m<=59 and s>=0 and s<=59
def __getattr__(self, name):
if '
%
' in name: return strftimeFormatter(self, name)
raise AttributeError, name
# Conversion and comparison methods
# Conversion and comparison methods
...
@@ -1121,6 +1124,8 @@ class DateTime:
...
@@ -1121,6 +1124,8 @@ class DateTime:
"""Return the second"""
"""Return the second"""
return self._second
return self._second
def strftime(self, format):
return strftime(format, gmtime(self.timeTime()))
# General formats from previous DateTime
# General formats from previous DateTime
...
@@ -1299,6 +1304,14 @@ class DateTime:
...
@@ -1299,6 +1304,14 @@ class DateTime:
return
float
(
self
.
_d
)
return
float
(
self
.
_d
)
class
strftimeFormatter
:
def
__init__
(
self
,
dt
,
format
):
self
.
_dt
=
dt
self
.
_f
=
format
def
__call__
(
self
):
return
self
.
_dt
.
strftime
(
self
.
_f
)
# Module methods
# Module methods
def
Timezones
():
def
Timezones
():
...
...
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