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
32797bc3
Commit
32797bc3
authored
Mar 13, 1997
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some new formats useful in DocumentTemplates
parent
24c5ef7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
1 deletion
+60
-1
lib/python/DateTime/DateTime.py
lib/python/DateTime/DateTime.py
+60
-1
No files found.
lib/python/DateTime/DateTime.py
View file @
32797bc3
...
...
@@ -44,7 +44,7 @@
"""Encapsulation of date/time values"""
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
6
$'
[
11
:
-
2
]
import
sys
,
os
,
regex
,
DateTimeZone
...
...
@@ -1069,6 +1069,65 @@ class DateTime:
self._hour,self._minute,self._nearsec,self._tz)
# New formats useful with DocumentTemplates
def mo_d_y4_hm_pm_z(self):
"""Return a string representing the object
\
'
s value
in the format: Mar 1, 1997 1:45 pm US/Eastern"""
return '
%
s
%
s
,
%
4.4
d
%
d
:
%
2.2
d
%
s
%
s
' % (
self._amon,self._day,self._year,self._pmhour,
self._minute,self._pm,self._tz)
def Mo_d_y4_hm_pm_z(self):
"""Return a string representing the object
\
'
s value
in the format: March 1, 1997 1:45 pm US/Eastern"""
return '
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
%
s
' % (
self._fmon,self._day,self._year,self._pmhour,
self._minute,self._pm,self._tz)
def mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: Mar 1, 1997 1:45 pm"""
return '
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._amon,self._day,self._year,self._pmhour,
self._minute,self._pm)
def Mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: March 1, 1997 1:45 pm"""
return '
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._fmon,self._day,self._year,self._pmhour,
self._minute,self._pm)
def D_mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: Saturday Mar 1, 1997 1:45 pm"""
return '
%
s
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._fday,self._amon,self._day,self._year,
self._pmhour,self._minute,self._pm)
def D_Mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: Saturday March 1, 1997 1:45 pm"""
return '
%
s
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._fday,self._amon,self._day,self._year,
self._pmhour,self._minute,self._pm)
def d_Mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: Sat March 1, 1997 1:45 pm"""
return '
%
s
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._aday,self._fmon,self._day,self._year,
self._pmhour,self._minute,self._pm)
def d_mo_d_y4_hm_pm(self):
"""Return a string representing the object
\
'
s value
in the format: Sat Mar 1, 1997 1:45 pm"""
return '
%
s
%
s
%
s
,
%
4.4
d
%
s
:
%
2.2
d
%
s
' % (
self._aday,self._amon,self._day,self._year,
self._pmhour,self._minute,self._pm)
# Python protocols
def __add__(self,other):
"""A DateTime may be added to a number and a number may be
...
...
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