Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.

6 Messages Forum Options Options
Embed this topic
Permalink
Vladislav Vorobiev-2
Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
Date Time Problem SQL

Hallo,

so einer Frage. Wenn ich die Zeit immer als UTC in der SQL Datenbank
speichern möchte / muss.
Wie kann ich abfragen in ob ich mich zu der Zeit in der Sommer oder in
Winterzeit befinde.

Z.B ich muss eine Liste von Zeiten für das Ganze Jahr abtippen und in
der Datenbank speichern. Ich habe einen Formular wo ich Datum und Zeit
eingeben kann. Der Formular würde dann an ein Script mit dem Inhalt

gmt='GMT+2' #fuer die jetzige sommerzeit.
date=DateTime(request.datum+'  ' +request.zeit +' '+ gmt).toZone('UTC').ISO()
addToDatenbank(date)

verschickt.

Bei welcher Methoder kann ich nachfragen ob sich das request.datum im
GMT+1 oder GMT+2 Bereich bewegt?

Gruesse
Vlad



_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope
Dieter Maurer
Re: Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
Vladislav Vorobiev wrote at 2008-7-19 19:31 +0200:

>Date Time Problem SQL
>so einer Frage. Wenn ich die Zeit immer als UTC in der SQL Datenbank
>speichern möchte / muss.
>Wie kann ich abfragen in ob ich mich zu der Zeit in der Sommer oder in
>Winterzeit befinde.
>
>Z.B ich muss eine Liste von Zeiten für das Ganze Jahr abtippen und in
>der Datenbank speichern. Ich habe einen Formular wo ich Datum und Zeit
>eingeben kann. Der Formular würde dann an ein Script mit dem Inhalt
>
>gmt='GMT+2' #fuer die jetzige sommerzeit.
>date=DateTime(request.datum+'  ' +request.zeit +' '+ gmt).toZone('UTC').ISO()
>addToDatenbank(date)
>
>verschickt.
>
>Bei welcher Methoder kann ich nachfragen ob sich das request.datum im
>GMT+1 oder GMT+2 Bereich bewegt?

Du musst nicht nachfragen. "DateTime.DateTime" (zumindest das von Zope)
macht es richtig:

>>> from DateTime import DateTime
>>> DateTime('2008-01-01 00:00')._tz
'GMT+1'
>>> DateTime('2008-04-01 00:00')._tz
'GMT+2'



--
Dieter


_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope
Vladislav Vorobiev-2
Re: Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
Hallo,

> Du musst nicht nachfragen. "DateTime.DateTime" (zumindest das von Zope)
> macht es richtig:
>
>>>> from DateTime import DateTime
>>>> DateTime('2008-01-01 00:00')._tz
> 'GMT+1'
>>>> DateTime('2008-04-01 00:00')._tz
> 'GMT+2'

Seltsam, aber bei mir liefern die beiden Beispiele GTM+0. Wie kommt das?



_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope
Vladislav Vorobiev-2
Re: Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
Am 3. August 2008 16:10 schrieb Vladislav Vorobiev <mymir.org@...>:

> Hallo,
>
>> Du musst nicht nachfragen. "DateTime.DateTime" (zumindest das von Zope)
>> macht es richtig:
>>
>>>>> from DateTime import DateTime
>>>>> DateTime('2008-01-01 00:00')._tz
>> 'GMT+1'
>>>>> DateTime('2008-04-01 00:00')._tz
>> 'GMT+2'
>
> Seltsam, aber bei mir liefern die beiden Beispiele GTM+0. Wie kommt das?
Hm, anscheinend gib es eine änderung bei Zope2.11.

/opt/Zope-2.10/lib/python# python
Python 2.5.2 (r252:60911, May 28 2008, 19:19:25)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> DateTime('2008-01-01 00:00')._tz
KeyboardInterrupt
>>> from DateTime import DateTime
>>> DateTime('2008-01-01 00:00')._tz
'GMT+1'

/opt/Zope-2.11/lib/python# python
Python 2.5.2 (r252:60911, May 28 2008, 19:19:25)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from DateTime import DateTime
>>> DateTime('2008-01-01 00:00')._tz
'GMT+0'

Hier gabs eine änderung an dem DateTime modul
Launchpad #200007: DateTime(anotherDateTime) now preserves the timezone.

 DateTime('2008-01-01 00:00').timezone()
'GMT+1'

Vlad



_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope
Andreas Jung-5
Re: Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by Vladislav Vorobiev-2


--On 3. August 2008 16:10:34 +0200 Vladislav Vorobiev
<mymir.org@...> wrote:

> Hallo,
>
>> Du musst nicht nachfragen. "DateTime.DateTime" (zumindest das von Zope)
>> macht es richtig:
>>
>>>>> from DateTime import DateTime
>>>>> DateTime('2008-01-01 00:00')._tz
>> 'GMT+1'
>>>>> DateTime('2008-04-01 00:00')._tz
>> 'GMT+2'
>
> Seltsam, aber bei mir liefern die beiden Beispiele GTM+0. Wie kommt das?
Als erstes ist die Frage, ob es ligitim ist auf private Variablen
zuzugreifen - nein. Ist der Fehler über die offiziellen API Methoden
von DateTime weiterhin vorhanden?

-aj


--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info@... - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting




_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope

attachment0 (201 bytes) Download Attachment
Vladislav Vorobiev-2
Re: Date Time SQLs UTC und Sommer und Winterzeit bei der Eingabe.
Reply Threaded MoreMore options
Print post
Permalink
In reply to this post by Vladislav Vorobiev-2
> Als erstes ist die Frage, ob es ligitim ist auf private Variablen
> zuzugreifen - nein. Ist der Fehler über die offiziellen API Methoden
> von DateTime weiterhin vorhanden?

Ja, ich habe ein Bugreport erstellt
https://bugs.launchpad.net/zope2/+bug/254425



_______________________________________________
zope mailing list
zope@...
https://mail.dzug.org/mailman/listinfo/zope