'How to reformat and modify a date string according to DIN standard: 5008:2020-03?

How can I reformat and modify a date string?


My code:

details = response.xpath('//div[@class="article-info"]')
for detail in details:
    released = detail.xpath('.//ul/li[1]/span[1]/span/text()').get()
    item['released'] = released
    yield item

My output:

Released 2021, September 24


Desired output:

  1. September, 2021

and:

24.09.2021




Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source