🗂

意図的にゼロ埋めできるか試すためのオブジェクトを作る

2024/08/20に公開

import datetime

class DateWithZeroPadding(datetime.date):
def str(self):
return self.strftime("%Y-%m-%d")

特定の日付のDateWithZeroPaddingオブジェクトを作成
custom_date = DateWithZeroPadding(2024, 8, 20)

出力
print("Custom date with zero padding:", custom_date)

Discussion