如何为 Chrono UTC 添加天数? [英] How do I add days to a Chrono UTC?
本文介绍了如何为 Chrono UTC 添加天数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试找到为 Chrono UTC
添加天数的首选方法.我想为当前时间添加 137 天:
I am trying to find the preferred way to add days to a Chrono UTC
. I want to add 137 days to the current time:
let dt = UTC::now();
推荐答案
use chrono::{Duration, Utc};
fn main() {
let dt = Utc::now() + Duration::days(137);
println!("today date + 137 days {}", dt);
}
这篇关于如何为 Chrono UTC 添加天数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文