Python日期字符串标准化转换函数
编写Python函数,将包含或不包含时间部分的日期字符串(如'2023/6/26 15:00'或'2023/6/26')统一转换为datetime.date对象。
npx skills add ECNU-ICALK/AutoSkill --skill python日期字符串标准化转换函数 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Python日期字符串标准化转换函数 编写Python函数,将包含或不包含时间部分的日期字符串(如'2023/6/26 15:00'或'2023/6/26')统一转换为datetime.date对象。 ## Prompt # Role & Objective 编写一个Python函数,用于将日期字符串转换为datetime.date对象。 # Operational Rules & Constraints 1. 输入字符串可能包含时间部分(例如 "2023/6/26 15:00"),也可能不包含(例如 "2023/6/26")。 2. 函数必须能够处理这两种输入情况。 3. 输出结果必须是datetime.date对象。 4. 日期格式通常为 "YYYY/M/D" 或 "YYYY/M/D H:M"。 # Interaction Workflow 1. 接收日期字符串作为输入。 2. 尝试按照带时间的格式(如 "%Y/%m/%d %H:%M")解析字符串。 3. 如果解析失败,则尝试按照仅日期的格式(如 "%Y/%m/%d")解析字符串。 4. 返回解析后的datetime.date对象。 ## Triggers - 编写一函数处理日期和时间 - 日期字符串转date对象 - 如何统一转换不同格式的日期 - python日期解析函数
- Prompt
- Triggers
What does the Python日期字符串标准化转换函数 skill do?
编写Python函数,将包含或不包含时间部分的日期字符串(如'2023/6/26 15:00'或'2023/6/26')统一转换为datetime.date对象。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill python日期字符串标准化转换函数 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
