django-strftime日期格式化问题

问题:strftime()函数报错

UnicodeEncodeError: 'locale' codec can't encode character 'u5e74' in position 2: encoding error

我的strftime()函数调用代码如下:

1 time.strftime('%Y年%m月%d日')

修改为:

1 strftime('%Y{y}%m{m}%d{d} %H:%M').format(y='', m='', d=''),

问题解决,希望给遇到同样问题的同学一个帮助!

转载于:https://blog.csdn.net/chengyuqiang/article/details/102775385

原文地址:https://www.cnblogs.com/fuyuteng/p/15001923.html