Re: [Zope] bug? pagetemplate using strftime
'item.fetcha' is what kind of instance? DateTime? datetime?
How to reproduce the behavior?
We need something that works on any system.
I don't know what type is. How can know? <tr tal:repeat="item container/getData"> <td tal:content="python: item.fecha.strftime('%d-%m-%Y');">09-01-2009</td> <td tal:content="item/fecha">2009/01/10</td> </tr> getData is a zsql method what connect to postgresql using zpsycopgda 2.0 conecction with enconding utf-8 serializable (with zope internal datetime option enabled and disabled) and not work :( This problem happen too with ms sql server 2000 with zpyodbc. Using %d break the day.
+-------[ Miguel Beltran R. ]---------------------- | | | 'item.fetcha' is what kind of instance? DateTime? datetime? | | How to reproduce the behavior? | | We need something that works on any system. | | | I don't know what type is. | How can know? | | | <tr tal:repeat="item container/getData"> | <td tal:content="python: item.fecha.strftime('%d-%m-%Y' | );">09-01-2009</td> | <td tal:content="item/fecha">2009/01/10</td> | </tr> | | getData is a zsql method what connect to postgresql using zpsycopgda 2.0 | conecction with enconding utf-8 serializable (with zope internal datetime | option enabled and disabled) and not work :( | | This problem happen too with ms sql server 2000 with zpyodbc. Using %d break | the day. If you strftime to show the hour and minute too, you will see as I previously said it is showing you the time in UTC (as determined by how many hours is it out). -- Andrew Milton akm@theinternet.com.au
If you strftime to show the hour and minute too, you will see as I previously said it is showing you the time in UTC (as determined by how many hours is it out).
I made a test with date 2009/05/07 using <dtml-var "fecha.timezone" > -- dmYzZ=<dtml-var fecha fmt="%d/%m/%Y %z %Z"> -- c=<dtml-var fecha fmt="%c"> -- x<dtml-var fecha fmt="%x"> -- X<dtml-var fecha fmt="%X"> and show this <bound )="" 07="" 05="" 2009="" datetime(="" of="" datetime.timezone="" method=""> -- dmYzZ=06/05/2009 -- c=05/06/09 19:00:00 -- x05/06/09 -- X19:00:00</bound> here I see what you said me, the hour is gmt-0500. If add in zope.conf <environment> TZ America/Mexico_City </environment> or in runzope.bat @set TZ=America/Mexico_City nothing change, render the same what before add TZ now, how I can show the correct date? help please I use MS Sql Server 2000 with field smalldatetime I never used before timezone.
+-------[ Miguel Beltran R. ]---------------------- | | | If you strftime to show the hour and minute too, you will see as I | previously said it is showing you the time in UTC (as determined by how | many hours is it out). | | | | I made a test with date 2009/05/07 using | <dtml-var "fecha.timezone" > -- dmYzZ=<dtml-var fecha fmt="%d/%m/%Y %z %Z"> -- | c=<dtml-var fecha fmt="%c"> -- x<dtml-var fecha fmt="%x"> -- X<dtml-var fecha | fmt="%X"> | | and show this | <bound )="" 07="" 05="" 2009="" datetime(="" of="" datetime.timezone="" method= | ""> -- dmYzZ=06/05/2009 -- c=05/06/09 19:00:00 -- x05/06/09 -- X19:00:00</ | bound> | | here I see what you said me, the hour is gmt-0500. | | | If add in zope.conf | <environment> | TZ America/Mexico_City | </environment> | | or in runzope.bat | @set TZ=America/Mexico_City | | nothing change, render the same what before add TZ | | now, how I can show the correct date? help please | I use MS Sql Server 2000 with field smalldatetime | I never used before timezone. You can't use stftime. You have to manually build a string with the format you want using the other methods inside DateTime. e.g. fetcha.aCommonZ() or build up your date using components such as; fetcha.day() fetcha.month() fetcha.year() -- Andrew Milton akm@theinternet.com.au
hello all, While I am doing good with grok after some reading now, I have another problem. Looking at the features of toscawidgets, am tempted to have it on top of zope (grok). I searched but did not find any proper tutorial or article for doing this. Has any one on the mailing list tryed this? happy hacking. Krishnakant.
You can't use stftime. You have to manually build a string with the format you want using the other methods inside DateTime.
e.g. fetcha.aCommonZ() or build up your date using components such as; fetcha.day() fetcha.month() fetcha.year()
I made a script what recive a parameter fecha(f) script pFecha: s="%02d-%02d-%04d" s=s % (f.day(),f.month(),f.year()) print s return printed the call is <td tal:content="python: container/pFecha(item.fecha)"> Thanks
participants (3)
-
Andrew Milton -
Krishnakant -
Miguel Beltran R.