Python Format DateTime mit "st", "nd", "rd", "th" (englisch ordinales Suffix) wie "S" von PHP wie "S"

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Python Format DateTime mit "st", "nd", "rd", "th" (englisch ordinales Suffix) wie "S" von PHP wie "S"

by Anonymous » 12 Apr 2025, 17:41

Ich möchte, dass ein Python DateTime -Objekt ausgibt (und das Ergebnis in Django verwendet) wie folgt: < /p>

Code: Select all

Thu the 2nd at 4:30
, aber ich finde es in Python auf keinen Fall, ST , nd , rd oder th wie ich mit PHP DateTime -Format mit dem S String (was "englische Ordinal -Suffix") kann (http://uk.php.net/manual/en/function.date.php).

Gibt es eine integrierte Möglichkeit, dies in Django/Python zu tun? strftime ist nicht gut genug (http://docs.python.org/library/datetime ... e-behavior).

Django hat einen Filter, der was ich will, aber ich möchte eine Funktion, keine Filter, um das zu tun, was ich will. Entweder eine Django- oder Python -Funktion ist in Ordnung.

Top