我想要一个python datetime对象输出(并在django中使用结果),如下所示:
Thu the 2nd at 4:30
Run Code Online (Sandbox Code Playgroud)
不过,我觉得没有办法在Python输出st,nd,rd,或th像我可以用PHP的日期时间格式S字符串(他们叫什么"英文后缀")(http://uk.php.net/manual/en/function. date.php).
有没有内置的方法在django/python中执行此操作? strftime不够好(http://docs.python.org/library/datetime.html#strftime-strptime-behavior).
Django有一个过滤器可以满足我的需求,但我想要一个功能,而不是过滤器,来做我想要的.一个django或python函数都可以.