ソースを参照

add `.date()`

blueloveTH 2 年 前
コミット
ce1bc278e3
1 ファイル変更3 行追加0 行削除
  1. 3 0
      python/datetime.py

+ 3 - 0
python/datetime.py

@@ -91,6 +91,9 @@ class datetime(date):
             raise ValueError("Second must be between 0 and 59")
             raise ValueError("Second must be between 0 and 59")
         self.second = second
         self.second = second
 
 
+    def date(self) -> date:
+        return date(self.year, self.month, self.day)
+
     @staticmethod
     @staticmethod
     def now():
     def now():
         t = localtime()
         t = localtime()