rust - 如何从 Chrono::DateTime 中获取年月日组件?
问题描述
该文档没有说明有关此主题的任何内容。我需要把它转换成Date<Tz>
? 即使这样,也没有从中获取年份组件的功能。
let current_date = chrono::Utc::now();
let year = current_date.year(); //this is not working, it should output the current year with i32/usize type
let month = current_date.month();
let date = current_date.date();
no method named `month` found for struct `chrono::DateTime<chrono::Utc>` in the current scope
解决方案
推荐阅读
- javascript - React Native 使用 Firebase 从 JSON 树中获取特定的子值
- c# - C# 用 Windows 窗体中使用的所有按钮填充数组
- c++ - 如何访问结构的成员
- javascript - 如何在 JSX (React) 中执行 JS 而不将其输出为 HTML?
- google-bigquery - BigQuery:无效日期错误
- reactjs - 如何避免使用来自 material-ui 的输入的十进制值
- r - 将csv文件从多个目录复制到R中的新目录
- c# - 使用 ASP.net MVC 上的现有表
- mysql - 无法匹配 freeradius 中的 mysql 字符串响应
- extjs - 带触发器的文本区域 - 如何将触发器添加到选项卡