Re: Time Format

Eberhard Froriep <[email protected]>
Newsgroups gmane.comp.cms.opengroupware.xmlrpc.devel
Message-ID <[email protected]>
Angela Kuehn schrieb:
> Hello,
> 
> I want to import dates from some files into OGo via the XMLRPC 
> interface. Unfortunately the dates in the file are in a local time 
> format. How can I search and import such a time format? The dates in 
> the OGo database have also local time format (date+time+02:00 for 
> example.)
> 
> Greetings
> 
> Angela

I am using the Python-Fragment:

import xmlrpclib, sys, pg
from time import *

# Bibliotheksfehler beim Berechnen der gmtime??
bibliotheksfehler=strftime("%H",\
    gmtime(mktime(strptime("2004-03-03","%Y-%m-%d"))))==\
    strftime("%H",gmtime(mktime(strptime("2004-06-06","%Y-%m-%d"))))
# Bibliotheksfehler Ende

def normalzeit(s,o):
   """ utc-zeit mit offset """
   z=mktime(strptime(s,"%Y-%m-%d"))+o
   if bibliotheksfehler:
    if ("2004-03-28"<=s<"2004-10-31") or ("2005-03-27"<=s<"2005-10-30") \
        or ("2006-03-26"<=s<"2006-10-29"):
       z=z-3600.0
   return strftime("%Y%m%dT%H:%M:%S",gmtime(z))

...

  startDate=normalzeit(vondatum,0)
  endDate=normalzeit(bisdatum,24.0*3600-1)

...


# Eintrag einrichten
   dict = {}
   dict['startDate']=xmlrpclib.DateTime(startDate)
   dict['endDate']=xmlrpclib.DateTime(endDate)
   dict['title']="Titel"

   eintrag = server.appointment.insert(dict)


8-)

Eberhard Froriep

--
NAME Eberhard Froriep
ADRESSE  RRZN, Schlosswenderstr.5, 30159 Hannover
TEL +49-511-762-4721, FAX -3003
EMAIL [email protected]

-- 
OpenGroupware.org XML-RPC
[email protected]
http://mail.opengroupware.org/mailman/listinfo/xmlrpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.