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

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

Post by Anonymous »

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.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post