Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #4606

Re: [Python-de] Datetime frage

Path csiph.com!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.tota-refugium.de!.POSTED!not-for-mail
From Manfred Gil <manfred-gil@t-online.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Datetime frage
Date Mon, 12 Dec 2016 18:07:55 +0000 (UTC)
Organization TOTA
Lines 81
Message-ID <o2mp1q$4ad$3@tota-refugium.de> (permalink)
References <o2k666$fir$1@tota-refugium.de> <1517572.IuxMI0Hij7@xrated> <mailman.12.1481486471.2322.python-de@python.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace tota-refugium.de 1481566075 4429 eJwNyckBAzEIA8CWOGVTjkFL/yUk8510KOYEEpGb6wecORvLC/v+w0Mx2zra4iS+i5Dupr/W0bpednWrhUF7FSN88RGhXJUEUkHz3t2aH7IvHuY= (12 Dec 2016 18:07:55 GMT)
X-Complaints-To abuse@news.tota-refugium.de
NNTP-Posting-Date Mon, 12 Dec 2016 18:07:55 +0000 (UTC)
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:DPl296GQ4foxSZa6ryr1l7bH3kY=
X-User-ID eJwNyckBwCAIBMCWkGMXy0GR/ktI5jthWLh0BDwmZqIOoHKaXbsmVTnstKS5YiceRvKWUbLa+I+3hT/XVcwPTqgUwg==
X-NNTP-Posting-Host eJwNyskBwCAIBMCWFFjQcuTY/ktI3jNQ315hDjcQtH2aIyfvRVZQr4KEHuloabpmNw6kppxtst6V91iRI+tvPjNBb99CnL54ZpyV/CFiPsW7H6I=
X-Face ^A]ge!7T,21w7RfS8x"Rz~_A=unigBwmA{c=2<S~dJcB9s@&Iwb+d@2Fg7Rz(PKWHQJ/_>}%r/X yuJL?9.7++L|&'[>\mqMUjGl>d(k]4On[fcds2Cd0tb$,z]qxtZTAs64W1H(}5;!pS]x%Ce.K]oAAU?(J)7{\TQQ/uOi[~co^
Xref csiph.com de.comp.lang.python:4606

Show key headers only | View raw


Am Sun, 11 Dec 2016 21:01:01 +0100 schrieb Hans-Peter Jansen:

> On Sonntag, 11. Dezember 2016 18:33:42 Manfred Gil wrote:
>> Hallo Liste,
>> 
>> ich spiele gerade mit Datetime rum, um das Modul verstehen zu können.
>> Dabei viel mir auf das ich nur die Englische Bezeichnung bekomme.
>> 
>> <Beispiel>
>> 
>> import datetime as dt
>> 
>> heute = dt.date.today()
>> 
>> print("Heute ist = ",heute)
>> 
>> print(heute.strftime("%A %d. %B %Y")) # Tag und Monat ist in English
>> 
>> import locale
>> 
>> print(locale.getlocale())
>> 
>> </Beispiel >
>> 
>> Die Ausgabe bei mir lautet:
>> 
>> Heute ist =  2016-12-11 Sunday 11. December 2016 ('de_DE', 'UTF-8')
>> 
>> 
>> Frage:
>> Wie bringe ich datetime bei, die Ausgabe in Deutsch zu schreiben, ich
>> dachte ( so hab ich es verstanden ) das, wenn locale richtig gesetz
>> ist, die Ausgabe auf Deutsch erscheinen sollte.
> 
> Dann mach das doch mal:
> 
> --> import locale --> locale.setlocale(locale.LC_ALL, '')
> 'de_DE.UTF-8'
> --> import datetime as dt --> heute = dt.date.today()
> --> print(heute.strftime("%A %d. %B %Y"))
> Sonntag 11. Dezember 2016 --> print(locale.getlocale())
> ('de_DE', 'UTF-8')
> 
> und probiere das mit beiden pythons.
> 
> Wenn Du unbedingt setlocale selber zusammenbauen willst, dann so:
> 
> Python 3.4.5 (default, Jul 03 2016, 12:57:15) [GCC] on linux Type
> "help", "copyright", "credits" or "license" for more information.
> --> import locale --> import datetime as dt --> heute = dt.date.today()
> --> print(heute.strftime("%A %d. %B %Y"))
> Sunday 11. December 2016 --> locale.setlocale(locale.LC_ALL,
> 'de_DE.UTF-8')
> 'de_DE.UTF-8'
> --> print(locale.getlocale())
> ('de_DE', 'UTF-8')
> --> print(heute.strftime("%A %d. %B %Y"))
> Sonntag 11. Dezember 2016
> 
> Aber wer will das schon... ;)
> 
> Viel Glück,
> Pete

richtig ... wer will das.

wieso muß ich setlocale überhaupt setzen.

ich wollt eigendlich nur eine Deutsche ausgabe von strftime.

Gruß Manfred

PS: wie ich schon schrieb klappt es, wenn ich  encoding mit angebe.




-- 
Kritiker sind blutrünstige Leute, die es nicht bis zum Henker gebracht
haben.
		-- George Bernard Shaw

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-11 18:33 +0000
  Re: [Python-de] Datetime frage "Andreas Jung" <lists@zopyx.com> - 2016-12-11 19:39 +0100
    Re: [Python-de] Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-11 19:20 +0000
      Re: [Python-de] Datetime frage "Andreas Jung" <lists@zopyx.com> - 2016-12-11 20:29 +0100
        Re: [Python-de] Datetime frage Hans-Georg Joepgen <test@joepgen.com> - 2016-12-11 20:49 +0100
          Re: [Python-de] Datetime frage "Andreas Jung" <lists@zopyx.com> - 2016-12-11 20:56 +0100
      Re: [Python-de] Datetime frage Christopher Arndt <chris@chrisarndt.de> - 2016-12-11 20:53 +0100
      Re: [Python-de] Datetime frage Stefan Schwarzer <sschwarzer@sschwarzer.net> - 2016-12-11 21:03 +0100
        Re: [Python-de] Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-12 18:01 +0000
          Re: [Python-de] Datetime frage Arnold Krille <arnold@arnoldarts.de> - 2016-12-12 21:04 +0100
      Re: [Python-de] Datetime frage Achim Herwig <python@wodca.de> - 2016-12-11 21:03 +0100
        Re: [Python-de] Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-12 18:04 +0000
          Re: [Python-de] Datetime frage Achim Herwig <python@wodca.de> - 2016-12-12 20:50 +0100
  Re: [Python-de] Datetime frage Hans-Peter Jansen <hpj@urpla.net> - 2016-12-11 21:01 +0100
    Re: [Python-de] Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-12 18:07 +0000
      Re: [Python-de] Datetime frage Hans-Peter Jansen <hpj@urpla.net> - 2016-12-12 21:42 +0100
        Re: [Python-de] Datetime frage Manfred Gil <manfred-gil@t-online.de> - 2016-12-13 17:38 +0000
          Re: [Python-de] Datetime frage Hans-Peter Jansen <hpj@urpla.net> - 2016-12-13 20:46 +0100

csiph-web