How do I get a string value of a DateTime object, in a given format
Hello, I'm sorry to ask such a basic DTML question...I just haven't been able to get this to work.. I'm hoping to use the Python slicing format to extract the various parts of a "pCommon" or aCommon" format date (the output from an SQL query) so that I can use them individually.. What is the syntax to get the string value of this non-strftime format date object, so that I can put it into a string variable for slicing? Thank you, Chris
I'm just learining this, but here's how you do it with Python (pasted in from an interactive session)... so maybe some expert can show you how to for this into DTML:
import string date="01/02/2001" datelist=[] for de in string.split(date,"/"): ... datelist.append(repr(int(de))) ... print string.join(datelist,"/") 1/2/2001
This strips out any leading zeros.
From: Chris Beaumont <cbeaumon@msri.org> Date: Tue, 27 Mar 2001 17:16:14 -0800 To: zope@zope.org Subject: [Zope] How do I get a string value of a DateTime object, in a given format
Hello,
I'm sorry to ask such a basic DTML question...I just haven't been able to get this to work..
I'm hoping to use the Python slicing format to extract the various parts of a "pCommon" or aCommon" format date (the output from an SQL query) so that I can use them individually..
What is the syntax to get the string value of this non-strftime format date object, so that I can put it into a string variable for slicing?
Thank you, Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Chris Beaumont -
marc lindahl