Python Forum
Extracting year from a string using strptime and datetime builtin
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extracting year from a string using strptime and datetime builtin
#4
Because year is not a method, it's an attribute (or field). Why did you think year was a method of the datetime class? The docs tell you that it's an attribute.
Reply


Messages In This Thread
RE: Extracting year from a string using strptime and datetime builtin - by ndc85430 - Aug-11-2020, 12:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  subtract 2 datetime string jss 4 794 Oct-19-2023, 02:42 PM
Last Post: Larz60+
Question Extracting Version Number from a String britesc 2 1,104 May-31-2023, 10:20 AM
Last Post: britesc
  Trying to get year not the entire year & time mbrown009 2 896 Jan-09-2023, 01:46 PM
Last Post: snippsat
  String formatting (strptime) issues Henrio 2 853 Jan-06-2023, 06:57 PM
Last Post: deanhystad
  TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'str' findbikash 2 9,630 Sep-18-2019, 08:32 AM
Last Post: buran
  Convert String to Datetime Object tkj80 2 33,830 Apr-20-2017, 08:45 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020