def date_conversion(self,date):
'''将中文日期转换成自己想要的格式如:2018年09月29日转换成2018-09-29'''
c = list(re.findall(r'(.*)年(.*)月(.*)日',date)[0])
print(c)
if len(c[1]) < 2:
c[1] = '0' + c[1]
print('-'.join(c))
new_date = '-'.join(c)
else:
print('-'.join(c))
new_date = '-'.join(c)
return new_date

相关文章:

  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-12-22
  • 2022-01-05
猜你喜欢
  • 2021-07-31
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2022-02-19
  • 2021-12-30
  • 2021-05-06
相关资源
相似解决方案