Hi, How do I convert an input date string "10/22/02" to "2002/10/22" in a date format? The variable I am checking against is in a timestamp format. Even if I time in the string to 2002/10/22, the check is not performed (text vs. timestamp). A pointer would be great, I will still continue to search the archives. Thanks. Larry McDonnell Proton Energy Systems 10 Technology Drive Wallingford, CT 06492 (203) 678-2181 Email:lmcdonnell@protonenergy.com www.protonenergy.com
McDonnell, Larry writes:
How do I convert an input date string "10/22/02" to "2002/10/22" in a date format? You split it at "/" and rearrange the peaces:
In Python (Script): month,day,year= datestring.split('/') return '20%02d/%02d/%02d' % (year,month,day) Dieter
On Sun, Nov 03, 2002 at 12:02:49AM +0100, Dieter Maurer wrote:
McDonnell, Larry writes:
How do I convert an input date string "10/22/02" to "2002/10/22" in a date format? You split it at "/" and rearrange the peaces: month,day,year= datestring.split('/') return '20%02d/%02d/%02d' % (year,month,day)
I had a similar problem and your post helped me a lot. But if I try to output my date (e.g. '2002/12/15 12:45:00') with <dtml-var dateStart fmt="%d.%m.%Y"> <dtml-var dateStart fmt="%H:%M"> I'm getting the following traceback. [...] __traceback_info__: ('dateStart', '2002/12/15 12:45:00', {'fmt': '%d.%m.%Y', '': 'dateStart'}) TypeError: an integer is required Any Ideas? MfG Steffen -- Manche Maenner bemuehen sich ein ganzes Leben lang, das Wesen einer Frau zu verstehen. Andere befassen sich mit weniger schwierigen Dingen, z.B. der Relativitaetstheorie.
--On Samstag, 9. November 2002 10:36 +0100 Steffen Hausmann <steffen@hausmann-family.de> wrote:
On Sun, Nov 03, 2002 at 12:02:49AM +0100, Dieter Maurer wrote:
McDonnell, Larry writes:
How do I convert an input date string "10/22/02" to "2002/10/22" in a date format? You split it at "/" and rearrange the peaces: month,day,year= datestring.split('/') return '20%02d/%02d/%02d' % (year,month,day)
I had a similar problem and your post helped me a lot.
But if I try to output my date (e.g. '2002/12/15 12:45:00') with
<dtml-var dateStart fmt="%d.%m.%Y"> <dtml-var dateStart fmt="%H:%M">
This works only if dateStarty is an instance of DateTime but not a *string* containing a date representation. You should use instead: <dtml-var "_.DateTime('2002/12/15')" fmt="%d.%m.%y" > -aj
On Sat, Nov 09, 2002 at 10:49:15AM +0100, Andreas Jung wrote:
--On Samstag, 9. November 2002 10:36 +0100 Steffen Hausmann <steffen@hausmann-family.de> wrote:
On Sun, Nov 03, 2002 at 12:02:49AM +0100, Dieter Maurer wrote:
McDonnell, Larry writes:
How do I convert an input date string "10/22/02" to "2002/10/22" in a date format? You split it at "/" and rearrange the peaces: month,day,year= datestring.split('/') return '20%02d/%02d/%02d' % (year,month,day)
I had a similar problem and your post helped me a lot.
But if I try to output my date (e.g. '2002/12/15 12:45:00') with
<dtml-var dateStart fmt="%d.%m.%Y"> <dtml-var dateStart fmt="%H:%M">
This works only if dateStarty is an instance of DateTime but not a *string* containing a date representation. You should use instead:
<dtml-var "_.DateTime('2002/12/15')" fmt="%d.%m.%y" >
That's it. Thank you very much. MfG Steffen -- Manche Maenner bemuehen sich ein ganzes Leben lang, das Wesen einer Frau zu verstehen. Andere befassen sich mit weniger schwierigen Dingen, z.B. der Relativitaetstheorie.
participants (4)
-
Andreas Jung -
Dieter Maurer -
McDonnell, Larry -
Steffen Hausmann