[Zope] DateTime Issues

2009-12-23 Thread Justin Dunsworth
I am having difficulties with time zones and rendering proper times/dates.
My time zone is GMT-6 (CST)... mysql reports the proper time/date, running
dtml-var expr=e.strftime('%c') shows Zope has the right date, running a
query straight from the SQLMethod shows the proper time in relation to the
field in mysql. However, when I try and run the variable in the dtml
document it gives the time in GMT+0.

For example... in mysql I have 2009-12-23 10:41:06 as the date of
the record. Running the SQL Method returns it as '2009/12/23 10:41:06 GMT+0'
-- So far so good but when I run dtml-var comment_date fmt=%m-%d-%y
%H:%M in my document it gives: 12-23-09 04:41.

I can get fmt=ISO (and other similar time functions) working and showing the
proper date/time but I'd rather have a little more control over how the time
is displayed. Is there any suggestions on what to do? I've looked many
places and couldn't find the answer.

I am running Zope 2.11.4-final, python 2.4.4, win32

Regards,
-J
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] DateTime Issues

2009-12-23 Thread Andrew Milton
+---[ Justin Dunsworth ]--
| I am having difficulties with time zones and rendering proper times/dates. My
| time zone is GMT-6 (CST)... mysql reports the proper time/date, running
| dtml-var expr=e.strftime('%c') shows Zope has the right date, running a
| query straight from the SQLMethod shows the proper time in relation to the
| field in mysql. However, when I try and run the variable in the dtml document
| it gives the time in GMT+0.
| ? 
| For example... in mysql I have 2009-12-23 10:41:06 as the? date of
| the? record.? Running the SQL Method returns it as '2009/12/23 10:41:06 GMT+0'
| -- So far so good but when I run dtml-var comment_date fmt=%m-%d-%y %H:%M
| in my document it gives: 12-23-09 04:41.
| ? 
| I can get fmt=ISO (and other similar time functions) working and showing the
| proper date/time but I'd rather have a little more control over how the time 
is
| displayed. Is there any suggestions on what to do? I've looked? many places 
and
| couldn't find the answer.
| ? 
| I am running Zope 2.11.4-final, python 2.4.4, win32
| ? 

using fmt / strftime on Zope DateTime strips the timezone info and
converts to localzone before rendering, which is why your times are out
by 6 hours... your distance from GMT.

-- 
Andrew Milton
a...@theinternet.com.au
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] DateTime Issues

2009-12-23 Thread Justin Dunsworth
Ah-ha... that would make sense. Is there a way to display it without
stripping the timezone information or at least add another time preset?

On Wed, Dec 23, 2009 at 11:30 AM, Andrew Milton a...@theinternet.com.auwrote:

 +---[ Justin Dunsworth ]--
 | I am having difficulties with time zones and rendering proper
 times/dates. My
 | time zone is GMT-6 (CST)... mysql reports the proper time/date, running
 | dtml-var expr=e.strftime('%c') shows Zope has the right date, running
 a
 | query straight from the SQLMethod shows the proper time in relation to
 the
 | field in mysql. However, when I try and run the variable in the dtml
 document
 | it gives the time in GMT+0.
 | Â
 | For example... in mysql I have 2009-12-23 10:41:06 as the date of
 | the record. Running the SQL Method returns it as '2009/12/23 10:41:06
 GMT+0'
 | -- So far so good but when I run dtml-var comment_date fmt=%m-%d-%y
 %H:%M
 | in my document it gives: 12-23-09 04:41.
 | Â
 | I can get fmt=ISO (and other similar time functions) working and showing
 the
 | proper date/time but I'd rather have a little more control over how the
 time is
 | displayed. Is there any suggestions on what to do? I've looked many
 places and
 | couldn't find the answer.
 | Â
 | I am running Zope 2.11.4-final, python 2.4.4, win32
 | Â

 using fmt / strftime on Zope DateTime strips the timezone info and
 converts to localzone before rendering, which is why your times are out
 by 6 hours... your distance from GMT.

 --
 Andrew Milton
 a...@theinternet.com.au

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] DateTime Issues

2009-12-23 Thread Andrew Milton
+---[ Justin Dunsworth ]--
| Ah-ha... that would make sense. Is there a way to display it without stripping
| the timezone information or at least add another time preset?

Not with the same level of flexibility.

The DateTime object contains everything you need to build it up
yourself though.

-- 
Andrew Milton
a...@theinternet.com.au
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] DateTime Issues

2009-12-23 Thread Lennart Regebro
On Wed, Dec 23, 2009 at 18:24, Justin Dunsworth
justin.dunswo...@gmail.com wrote:
 I am having difficulties with time zones and rendering proper times/dates.
 My time zone is GMT-6 (CST)... mysql reports the proper time/date, running
 dtml-var expr=e.strftime('%c') shows Zope has the right date, running a
 query straight from the SQLMethod shows the proper time in relation to the
 field in mysql. However, when I try and run the variable in the dtml
 document it gives the time in GMT+0.

 For example... in mysql I have 2009-12-23 10:41:06 as the date of
 the record. Running the SQL Method returns it as '2009/12/23 10:41:06 GMT+0'
 -- So far so good but when I run dtml-var comment_date fmt=%m-%d-%y
 %H:%M in my document it gives: 12-23-09 04:41.

What would you expect it to be? It seems correct to me.

-- 
Lennart Regebro: Python, Zope, Plone, Grok
http://regebro.wordpress.com/
+33 661 58 14 64
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] DateTime Issues

2009-12-23 Thread Andrew Milton
+---[ Lennart Regebro ]--
| On Wed, Dec 23, 2009 at 18:24, Justin Dunsworth
| justin.dunswo...@gmail.com wrote:
|  I am having difficulties with time zones and rendering proper times/dates.
|  My time zone is GMT-6 (CST)... mysql reports the proper time/date, running
|  dtml-var expr=e.strftime('%c') shows Zope has the right date, running a
|  query straight from the SQLMethod shows the proper time in relation to the
|  field in mysql. However, when I try and run the variable in the dtml
|  document it gives the time in GMT+0.
| 
|  For example... in mysql I have 2009-12-23 10:41:06 as the?date of
|  the?record.?Running the SQL Method returns it as '2009/12/23 10:41:06 GMT+0'
|  -- So far so good but when I run dtml-var comment_date fmt=%m-%d-%y
|  %H:%M in my document it gives: 12-23-09 04:41.
| 
| What would you expect it to be? It seems correct to me.

He expects (as most of us expect at first) the time not to be
converted to the local zone just because you want to format the
time display.

-- 
Andrew Milton
a...@theinternet.com.au
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )